Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS (2016) Make It Beautiful With CSS Adding a Style to several Elements using Class

style.css

in the css file create a rule for the social-links class.you dont need to write any style instructions yet

index.html
<!doctype html>
<html>
  <head>
    <title>List Example</title>
    <link rel="stylesheet" href="styles.css">
  </head>
  <body>

    <a href class="social-links">Follow me on Twitter!</a>
    <a href class="social-links">Send me an Email!</a>

  </body>
</html>
styles.css
<!doctype html>
<html>
 <head>
 <title>list example</title>
<link rel=stylesheet"href=stylesheet.css"
</head>
<body>

   <a href class."social-links"follow me on twitter</a>
<a href class."social-links"send me an email</a>
</body>
</html>

2 Answers

Asad Masood
Asad Masood
1,963 Points

In style.css you are only supposed to create the rule which can be done as:

.social-links { }

thank you

Dave Harker
PLUS
Dave Harker
Courses Plus Student 15,510 Points

Hi Bernard Chiyangwa,

You've removed the assignment to the href attribute in your html. You should leave that as is and add the class as a seperate attribute. e.g. <a class="sampleClass" href="#">This is an Example</a>

CSS rules are made up of a selector or selectors which determine what the rule will apply to, and a declartion block. A declaration block contains a property and a value. These properties and values style the element(s) the rule is applied to.

There are many selector types, you can learn more about them at the MDN page on CSS selectors
There are also many properties, read about the most common on the MDN CSS Properties Reference Page

The selector used in the rule for this challenge is the Class selector which uses a dot notation.
Taken from the MDN page on CSS selectors

Class selector
Selects all elements that have the given class attribute.
Syntax: .classname
Example: .index will match any element that has a class of "index".

So a specific example of a CSS class rule might look something like this:
The HTML

<p class="example">This is my example</p>

The CSS

.example{
    font-size: 1.5em;
    font-weight: 600;
    color: blue;
}

I hope you find this information useful and are able to solve your challenge.

Happy coding, :dizzy:
Dave