Different html tag but same identifier

Can I have two tags, such as div and ul with the same identifier?

Sample html code:

<div id="articleOptions">
    <ul id="articleOptions">
        <li>Share</li>
        <li>View</li>
        <li>Read Later</li>
    </ul>
</div>

Could this be valid html code?

+3
source share
2 answers

No . IDare unique and should be used only once for each document. - source
You can do this, but it will not be valid.

But you can have the same class-name as many times as you want.

.articleOptions {
   // code
}

.. or if you want to div, and ulact in different ways:

div.articleOptions {
   // code
}

ul.articleOptions {
   // code
}

You can check your code here W3 Validator

+7
source

Id .... class

div.articleOptions{
// your css
}

ul.articleOptions{
//your css
}
0

All Articles