Jump to content

Archived

This topic is now archived and is closed to further replies.

yana

<div> tags

Recommended Posts

What is the difference between using ID and CLASS? Is it better to use one than another???
For example...

<div id="frame">...</div>  and <div class="frame">...</div>
#frame {
width:777px;
height:100%;
margin-right:0px;
margin-left:0px;
margin-top:0px;
margin-bottom:0px;
padding:0px;
text-align:left;
background-color: #FFF;
}

.frame {
width:777px;
height:100%;
margin-right:0px;
margin-left:0px;
margin-top:0px;
margin-bottom:0px;
padding:0px;
text-align:left;
background-color: #FFF;
}

Share this post


Link to post
Share on other sites
id should only be used ONCE, class can be used many, many times, in the same file.

Share this post


Link to post
Share on other sites
[quote author=AndyB link=topic=108507.msg436588#msg436588 date=1158594893]
id should only be used ONCE, class can be used many, many times, in the same file.
[/quote]

and, in addition to that, each element can only carry one id, but each tag could hold many, many classes as well

Share this post


Link to post
Share on other sites
What do u mean by "each element can only carry one id"???

Something along these lines?? <div id="test"> is correct but <div id="test" id="test2"> is incorrect...while <div class="test"> is correct and <div class="test" class="test2"> is correct as well????????

Share this post


Link to post
Share on other sites
actually, it's this: the following two lines show how to apply a single id and multiple classes
[code]
<div id="myID"></div>

<div class="red bold someStyle"></div>
[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.