Home » Blog » How to specify a CSS link style within a div using CSS

How to specify a CSS link style within a div using CSS

Do you need to format a link style within a div in your CSS style sheet? Let’s say you’ve designed your site to have a white background and all your links are styled to be small, Georgia, black and underlined.

a:link {
font-family: Georgia, “Times New Roman”, Times, serif;
font-size: small;
color: black;
text-decoration: underline;
}

But you want your navigation (#nav) to have medium white lettering without an underline. How do you do that? Simple. In your style sheet, make a link style specific to that div.

#nav a:link {
font-family: Georgia, “Times New Roman”, Times, serif;
font-size: medium;
color:white;
text-decoration: none;
}

Pin It on Pinterest