Posted by: james | October 12, 2009

Basic technique to apply CSS to div or ul or li…

if we have one div its id is new-nav… and in that we have ul, in that li, in that a tag…
so now if we want to apply css then to apply css to ul use this

#new-nav ul { ur css…}

to apply css to li use this

#new-nav ul li { ur css…}

to apply css to a use this

#new-nav ul li a { ur css…}

if you want to apply css when anyone hove on that link then use this..

#new-nav ul li a:hover { ur css…}

now if you want to apply class to any tag..for ex you want to apply class to li.. then do this..
for ex. in our div new-nav in that ul and in that li and you want to apply class active to li…

<div id=”new-nav”>
<ul>
<li>
Now here you want to apply class active to li then in css file you can write..as under
</li>
</ul>
</div>

write in css file like this..

#new-nav ul li.active {ur css….}

thus you can apply class to any tag and then u can use that class in ur html file..

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: