![]() |
|
||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|||||
|
|
#1 |
|
WLC Member
Join Date: Jan 2011
Posts: 49
|
Hi. I have a UL within another UL. Both have ids and are styled differently. For some reason however, the child UL is using the parent UL's styling.
How can I ensure the child uses the correct styling? Code:
<ul id="portfolio_show"> <li class="portfolio_thumb_1"> <li class="portfolio_thumb_2"> <li class="portfolio_thumb_3"> <li class="portfolio_thumb_1"> <li class="portfolio_thumb_2"> <ul id="pagination"> </ul> |
|
|
|
|
|
#2 |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
A list cannot be a direct decendant of another UL it has to be a child of a list item.
And list items (</li>) HAVE to be closed! |
|
|
|
|
|
#3 |
|
WLC Member
Join Date: Jan 2011
Posts: 49
|
The code I copied in is from firebug, so of course the items are closed.
Thanks |
|
|
|
|
|
#4 |
|
WLC Member
Join Date: Mar 2012
Posts: 17
|
It happens due to hierarchy. The best approach is to assign different values for the parent and the child property as per the need.
Suppose if you have assigned padding:10px to the parent then the child will also take 10px as padding automatically. If you do not want the padding for the child then you have to assign padding:0px for the child. I hope you can understand what i am trying to say
|
|
|
|
|
|
#5 | |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
Quote:
if you are providing code, paste it from the source code so we get the whole picture That way it saves wasting your time and ours pointing to problems that don't actually exist, but obviously exist in what you provide. It's a bit like taking your cat to the vets because your dog is not well. |
|
|
|
|
|
|
#6 |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
Anyway, Your ruleset for the child ul should be
Code:
ul#id li.class ul#id {
// rules
}
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
Linear Mode |
|
|