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

how do i create a rule

how do i create a rule in css?

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
style

4 Answers

Dave Harker
PRO
Dave Harker
Pro Student 15,507 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

.social-links{ 
  /*blahblah*/
}
Austin Erb
Austin Erb
6,827 Points

A rule is what allows you to change and define properties of your html.

An empty rule would look like this:

p {
}

.social-links{}