Learn Enough HTML, CSS and Layout to be Dangerous: An Introduction to Modern Website Creation and Templating Systems by Lee Donahoe & Michael Hartl

Learn Enough HTML, CSS and Layout to be Dangerous: An Introduction to Modern Website Creation and Templating Systems by Lee Donahoe & Michael Hartl

Author:Lee Donahoe & Michael Hartl [Lee Donahoe]
Language: eng
Format: epub
Publisher: Addison-Wesley Professional
Published: 2022-08-02T00:00:00+00:00


Figure 9.21: Making the first nav link orange.

Listing 9.18: Changing the appearance of just the first link.

css/main.css

.header-logo:hover, .header-logo:active { opacity: 0.5; } .header-nav > li:first-child a { color: #ed6e2f; } .header-nav > li:first-child a:hover { color: #000; }

Note how specific we are in Listing 9.18: We’re using the child selector to target only lis that are direct children of the .header-nav class. You don’t technically need this level of precision, but later on we will add in a dropdown menu in the header (Section 13.4), and if we target styles too generally then we’ll make styling the dropdown difficult.

Now when you save and refresh the first link should look different (Figure 9.21).



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.