Web Design Forum  
 
Go Back   Web Design Forum > Web and Graphic Design > Web Design

Like Tree1Likes

Reply
 
LinkBack Thread Tools Display Modes
Old 01-18-2012, 05:48 AM   #11
New Member
 
Join Date: Jan 2012
Posts: 22
Default

He that worked.
So i need to target the list within the class cat-meta.

I was targeting the cat-meta.
Why doesn't the CSS understand that?
The list is still within the same class as I targeted first?
Skyn2 is offline   Reply With Quote


Old 01-18-2012, 05:51 AM   #12
Gold Member
 
conor's Avatar
 
Join Date: Oct 2008
Location: Ireland
Posts: 349
Default

Quote:
Why doesn't the CSS understand that?
CSS isn't smart, it does exactly what you tell it to and can't predict all situations of human error. ie If the rules aren't applied to the correct element they will have a different effect than desired.
__________________
Conor

Last edited by conor; 01-18-2012 at 05:54 AM.
conor is offline   Reply With Quote
Old 01-18-2012, 06:59 AM   #13
Diamond Member
 
Phreaddee's Avatar
 
Join Date: Feb 2011
Location: Newcastle, Australia
Posts: 1,137
Default

Generally speaking for a nav list you would have four css selectors
ul
ul li
ul li a
ul li a:hover

Giving your ul display:inline wouldnt affect the ul li as their default style is inline:block, if you want your links to have a particular style you would target ul li a, likewise a style pertaining to the hover would only work on the ul li a:hover

Without specifity your css uses the defaults. Which vary based on the browser (unless you use resets) this obviously is not preferred.
conor likes this.
__________________
if (headhurts == "possibly") {
alert ("keep going!");
}
else if (headhurts == "yes") {
alert ("go to sleep");
}
else if (headhurts == "damn !@#$ mofo scripts...") {
alert ("give up and have a beer!");
}
else {
alert ("watch TV");
}
Phreaddee is offline   Reply With Quote
Old 01-18-2012, 03:35 PM   #14
New Member
 
Join Date: Jan 2012
Posts: 22
Default

Because I use ul li a, CSS attacks the element within li and ul.
What I don't understand, is if I use inline: block for UL, why it doesnt attack everything in the UL?

Wouldnt it use the CSS inline: block, instead of the default if I give it that code?

Is it because it's too unspecific?

Quote:
Originally Posted by Phreaddee View Post
Generally speaking for a nav list you would have four css selectors
ul
ul li
ul li a
ul li a:hover

Giving your ul display:inline wouldnt affect the ul li as their default style is inline:block, if you want your links to have a particular style you would target ul li a, likewise a style pertaining to the hover would only work on the ul li a:hover

Without specifity your css uses the defaults. Which vary based on the browser (unless you use resets) this obviously is not preferred.
Skyn2 is offline   Reply With Quote
Old 01-18-2012, 08:30 PM   #15
Diamond Member
 
Phreaddee's Avatar
 
Join Date: Feb 2011
Location: Newcastle, Australia
Posts: 1,137
Default

ul {display:block;} would make the list behave like a block element (ie, stack on top)
ul {display:inline} would make the list behave like an inline element (ie not break to new line)
However the list items (ul li) would still be display:block and still stack on top as you havent assigned a style to them. It just doesnt flow down like that. Its like suggesting you put display:inline on the body tag and assuming that everything contained within the body to therefore act as inline elements.
It doesnt work like that. And for good reason too. Everything needs its own style assigned to it.
Seriously read the initial tutorial link, it explains this concept much better than i can.
I would also do a google search and find out what (by default) are block element and what are inline elements. <span> -inline, <div> - block for instance.
__________________
if (headhurts == "possibly") {
alert ("keep going!");
}
else if (headhurts == "yes") {
alert ("go to sleep");
}
else if (headhurts == "damn !@#$ mofo scripts...") {
alert ("give up and have a beer!");
}
else {
alert ("watch TV");
}
Phreaddee is offline   Reply With Quote


Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:44 AM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.