Jump to content
Max Castril

<div id = "hello">

Recommended Posts

Interesting problem with the W3 schools checker 'Nu Html Checker'.

I am using a CSS file that I have written which includes a reference 'area1'.

I am calling it on many occasions e.g. <a href="mountains.php"  id = "area1">Mountains</a> as I only want 'Mountains' to be affected by this particular CSS. 

When I run Nu Htnl Checker, I get this:

Error: Duplicate ID area1.

From line 330, column 148; to line 330, column 185

></td><td><a href="mountains.php" id = "area1">Mounta

Surely I can use a piece of CSS more than once in an html document??


Edited by Max Castril

Share this post

Link to post
Share on other sites

If you want to apply a style to multiple elements, use the class attribute.

The ID attribute is intended to identify one specific element on the page, it is designed that way to make accessing elements in Javascript more efficient. Instead of traversing the DOM tree, the browser already has pointers directly to all the elements that have IDs.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...