Click to See Complete Forum and Search --> : How to define font for all UL and its a?


toplisek
11-06-2009, 07:29 AM
How to define font for all particular UL and its links as it seems there can be sourunded DIV element but it will not work font size and even add to UL will not work. Just LI with defined fonts will work as they have also links.

If I define ID within div it will not work font within UL as it has LI and sometimes links.

Is possible to avoid this and put simple one time font.

See sample UL:

<div>
<ul>
<li><a href="...">Home</a></li>
<li><a href="...">Services</a></li>
<li><a href="...">Blog</a></li>
<li><a href="...">Forum</a></li>
<li><a href="...">About Us</a></li>
</ul>
</div>


It will not work font size BUT only defined for LI a not all content within UL (links or not links).

Kor
11-06-2009, 08:43 AM
Not very clear what exactly you want, but I guess you may use a wildcard *

#mydiv ul, #mydiv ul *{
color:#CC0000;
}

toplisek
11-06-2009, 09:04 AM
you see at LI can be link or without
Within div can be link or without

So, issue is how to define the same font in all specifications within DIV.
Is * compliant to all browsers?

Kor
11-06-2009, 09:55 AM
you see at LI can be link or without
Within div can be link or without

So, issue is how to define the same font in all specifications within DIV.
Is * compliant to all browsers?
Yes * is full compliant. To define the same class for all the elements within a div with the id, say, "mydiv" it is enough to:

#mydiv *{
color:#ff0000;
}

You may also specify only the tags you want to follow that class:

#mydiv ul, #mydiv a{
color:#ff0000;
}

That means only the UL elements and the A elements nested in that DIV will follow that class, but not the other elements (for instance not the LI elements)