Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

8. Getting Started with CSS: Adding a Li... > It’s time to talk about your inherit...

It’s time to talk about your inheritance...

Did you notice when you added the font-family property to your “p” selector that it also affected the font family of the elements inside the <p> element? Let’s take a closer look:

image with no caption

The elements inside the <p> element inherit the font-family style from <p>

Just like you can inherit your blue eyes or brown hair from your parents, elements can inherit styles from their parents. In this case, the <a> and <em> elements inherited the fontfamily style from the <p> element, which is their parent element. It makes sense that changing your paragraph style would change the style of the elements in the paragraph, doesn’t it? After all, if it didn’t, you’d have to go in and add CSS rules for every inline element in every paragraph in your whole site... which would definitely be so NOT fun.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint