Jump to content

css selector issue


Liquid Fire

Recommended Posts

here is my html code:

<div class="team_info">
<div class="name center"><h3>Ryan Zec</h3></div>
<div class="name"><span class="header">Job:</span> One of my biggest responsibilities is maintianing the website.  I am also involved in many other aspects of the company include game design and programming.</div>
<div class="name"><span class="header">Birth Place:</span> Waltham, MA</div>
<div class="name"><span class="header">Interests:</span> Movies, Music, Bike Riding, Video Games, Just Having Fun.</div>
<div class="name"><span class="header">Fav. Music:</span> Eminem, A Day to Remember, Linkin Park, Papa Roach, Limp Bizkit</div>
<div class="name"><span class="header">Fav. Movies:</span> Star Wars, Liar Liar, Spaceballs, </div>
<div class="name"><span class="header">Fav. Websites:</span> www.gamedev.net, www.3dbuzz.com, www.phpfreaks.com</div>
</div>

 

now this css works:

 

div > span.header

{

font-weight: bold;

font-size: 24px;

}

 

but this does not

 

div.team_info > span.header

{

font-weight: bold;

font-size: 24px;

}

 

why does the second one not work?

Link to comment
https://forums.phpfreaks.com/topic/67674-css-selector-issue/
Share on other sites

The > symbol is used to indicate that it is a direct descendant, IE in the very first child element. The first one tells it to select and span.header tags that are directly after div elements, while the second only applies to span.headers directly beneath div.team_infos. Just take out the > and it will work fine.

Link to comment
https://forums.phpfreaks.com/topic/67674-css-selector-issue/#findComment-339992
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.