PDA

View Full Version : General Que.


otnj2ee
08-16-2007, 10:55 PM
For a test.css file which contains:

[1]
#tabs_1{
color:#333;
}
--Does this mean the said color applies to all the elements within the
<div id="tabs_1">... </div>?

[2]
#tabs_1 .selected_tab {
background-position:0 -100px;
border-width:0;
}

--Does this mean the said properties apply to all the elements within the
<div id="tabs_1"> and the class="selected_tab"

<div id="tabs_1">
<div class="selected_tab">aaaaa</div>
<div class="selected_tab">bbbbb</div>
<div class="selected_tab">ccccc</div>
</div> ?


[3]
tabs_1 .selected_tab a {
background-position:100% -100px;
padding-bottom:10px;
}

--Does this mean the said properties apply to all the <a> within the
<div id="tabs_1"><div class="selected_tab">
<a>1111</a>
<a>2222</a>
<a>2</a>
</div>
</div>


Thanks

Scott

bazz
08-16-2007, 11:01 PM
pretty much but, you can only have an ID once in the page. if you need that style for more than one 'instance' you need to use class instead of ID.

I can;t recall just now whether you can assign a number to an ID (or class), name. I may be mixing up the naming of variables in perl, so someone else might chip in soon unless I can remember for sure.

bazz

VIPStephan
08-16-2007, 11:06 PM
Yes.
No.
Yes.


Some properties are inherited to children of an element and some are not.

Backgorund position and border properties are not inherited and apply only to the element you specified them for. That means in your example number 2 it would only apply to elements with class selected_tab within elements with ID tabs_1, or to the links within the specified elements in example 3.