using same ids for many tags?

Posted by gaurav rathor on Stack Overflow See other posts from Stack Overflow or by gaurav rathor
Published on 2012-06-18T09:06:27Z Indexed on 2012/06/18 9:16 UTC
Read the original article Hit count: 168

Filed under:
|
|
|

here is the example code that i was testing and i got confused that every one says that we can use or we should use only one time per id but i have testes using using it multiple times but its giving me the correct output. so what should i do. it is kinda working same like class for me in this example code:

<html>
<head>
<style>

#exampleID1 { background-color: blue; } 
#exampleID2 { text-transform: uppercase; } 

</style>
</head>
<body>
<p id="exampleID1">This paragraph has an ID name of "exampleID1" and has a blue CSS defined background.</p>
<p id="exampleID2">This paragraph has an ID name of "exampleID2" and has had its text transformed to uppercase letters.</p>

<address id="exampleID1">

Written by W3Schools.com<br />
<a href="mailto:[email protected]">Email us</a><br />
Address: Box 564, Disneyland<br />
Phone: +12 34 56 78
</address>


<blockquote id="exampleID1">
Here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation.
</blockquote>

</body>
</html>

please see the above code and answer me that why we should not use id selector two times in a page while its working fine.

© Stack Overflow or respective owner

Related posts about html

Related posts about css