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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.