Hi,
I remember someone telling me that you should not repeat either ‘div class’ or ‘div id’ more than once per webpage. Which one was it? I cannot remember.
Thanks,
Matt.
Hi,
I remember someone telling me that you should not repeat either ‘div class’ or ‘div id’ more than once per webpage. Which one was it? I cannot remember.
Thanks,
Matt.
id
To expand a bit on ingleslenobel’s reply, you can only use each id once per page - whether on a div or anything else. You can have more than one div (or other element) with an id, provided the ids are different. So
<div id="foo">some stuff</div>
<div id="foo">some more stuff</div>
is not valid, but
<div id="foo">some stuff</div>
<div id="bar">some more stuff</div>
is fine.
ok - But i can repeat classes, right?
<div class="foo">some stuff</div>
<div class="foo">some more stuff</div>
You can indeed. And you can use them on multiple elements, too, if necessary.
<h1 class="foo">A heading</h1>
<div class="foo">some stuff</div>
<div class="foo">some more stuff</div>
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.