Is more id's and classes allowed for html tags?

hebhansen
hebhansen's picture

Joined: 2009-02-10
Posts: 572
Posted: Sat, 2010-03-13 18:00

Just wondered if an html tag can have more than one div/id and more than one class:

Quote:
<ul id="g-album-grid" class="ui-helper-clearfix" id="home" title="Grid" selected="true"></ul>

all the best
HB - http://www.image.agentura.dk

 
griffinmt
griffinmt's picture

Joined: 2009-09-06
Posts: 128
Posted: Sat, 2010-03-13 18:32

Any html tag that can use a class attribute can reference any number of defined classes by supplying the class names in a space separated list in the class="" attribute.

Martyn T. Griffin

 
hebhansen
hebhansen's picture

Joined: 2009-02-10
Posts: 572
Posted: Sat, 2010-03-13 19:18

How about id

So my example above won't work, this will?

<ul id="g-album-grid home" class="ui-helper-clearfix" title="Grid" selected="true"></ul>

Space in id = 2 div's

all the best
HB - http://www.image.agentura.dk

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2139
Posted: Sat, 2010-03-13 20:21

id should be unique - it is an ide
not only should it be unique within element, it should be unique within the page. this is part of the standard.
why would you need dual ids? class is sufficient.

 
hebhansen
hebhansen's picture

Joined: 2009-02-10
Posts: 572
Posted: Sat, 2010-03-13 23:15

Trying to merge two themes and two different css and two different class sets and div sets. Hoped to make it easy by keeping the two css files and ad div/class everywhere. But true not the right way and a bit complex to control the same from two sides. Will try to sort it out

Div around an item with id should work I assume

all the best
HB - http://www.image.agentura.dk