FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

css anchor rules?

 


yo.hassan
I have a class called .rightcol. Now i wanted to have independent ul, li, a, a:hover rules for .rightcol only. It would be different than the existing normal ul, li, a, a:hover rules. So i tried to make it this way.. <code>#rightcol ul (rules:here) #rightcol li (rules:here) #rightcol a (rules:here). #rightcol a:hover (rules:here) </code> and calling it from the html this way.. <div id="rightcol"><ul class="rightcol"><li><a href="#">links</a></div> but the rule isn't working. Its mixing with the general rules! How can i have two or styles for different divs? Any idea, help or link would be great help. Thanks. Note.. '(' means brace. Writing from my phone and doesn't have the character
Gundamxxg
first off you only need to apply the class to the parenting div where the ul and stuff will reside.

second when you call a class with css the proper format is

Code:


.rightcol {code};


finished product would look something like the following:
Code:

<style type="text/css">

.rightcol {
code: here;
}

.rightcol ul {
code: here;
}

.rightcol ul li a {
code: here;
}
</style>

<div class="rightcol">
div stuff in here
</div>

yo.hassan
Gundamxxg wrote:
.rightcol ul li a {
code: here;
}

[/code]
here u put 3 rules/selector ul, li, a together. how would i call the li or a alone? sorry but i'd be very glad to see ur words. thanks
rohan2kool
you can't exactly call CSS selectors who have been assigned to html elements [like in ur case ul, li, a]. In case you want them to have independent values you can use:

Code:


.rightcol a {code};
.rightcol ul {code};
.rightcol li {code};



If you say wanna 'call' it, assign CSS values for a class inside a class, like:

Code:


.rightcol .links {code};


the properties in this for example, will only apply to those elements which have a class 'links' and are set inside the hierarchy of element i.e are child to a parent element which has a class 'rightcol'.
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.