Frontend Engineering, Volume II

CSS: Example 1e—Use ID Selectors

© 2013, Martin Rinehart


Inside your embedded style sheet, add the ID styles here:

        #special_link {
            border: blue outset 2px;
            padding: 5px;
        }
    </style>
    

Again, we always add styles from most- to least-general. Id styles come last.

padding? The padding is the space between the content and the border. We'll take a closer look in Chapter 2.

In the markup, add a link to style (it doesn't need to link to a real page), as you see here:

    <a id='special_link' class='oversize'
            href='another-page.html'>Another page!</a>
    

Our styled link looks like this:


Web page with all paragraphs bordered in solid blue.

Now you know padding. It's a style you'll use constantly.


Feedback: MartinRinehart at gmail dot com

# # #