Reputation: 221
In my website I use CSS3 media queries for different styles on mobile. Then in my HTML code I add some div
to show only in mobile device that duplicate another div
that I hide.
In W3C validation it is an error, with "Duplicate ID".
But the ID not is duplicate because one of this is hidden.
How can I resolve this problem?
Upvotes: 1
Views: 1886
Reputation: 96697
The id
attribute‘s value
[…] must be unique amongst all the IDs in the element's home subtree […]
So it doesn’t matter if the element is visually hidden.
Make them unique, or use some other hook, e.g. a class
value.
Upvotes: 2