- This topic is empty.
June 16, 2013 at 12:45 am #45559JunniMember
how much tags and classes a tAG can absorb ????June 16, 2013 at 1:11 am #138874
Html elements can take on as many id and class attribute values as you’d like, so long as they’re enclosed in quotes and are separated by spaces. Below are two examples of an element with five id’s assigned to it and an element with five classes assigned to it. But again, an element can have as many id or class attribute values as you’d like.Some text.Some more textJune 16, 2013 at 1:13 am #138875
Here’s the bit of code to which I was referring.
`Some more text
EDIT: Apparently, I’m not able to wrap my text using the code function on this site…June 16, 2013 at 4:32 am #138886JunniMember
i got what i want which is
we can add differnt classes as the method above as you told thanx alotJune 16, 2013 at 5:10 am #138889CodeGraphicsParticipant
@posterity576, this is what you want to achieve.
In order to get your code as you want it, hit your keyboard spacebar 4 times to give some indent, then write your codes.June 16, 2013 at 5:11 am #138891Kitty GiraudelParticipant
That’s actually one of the main principles of CSS. Using multiple classes to style elements.June 16, 2013 at 5:54 am #138899
@CodeGraphics It seems like it fixed itself (see two comments above yours). Thanks, though, and that’s what I was trying to achieve.June 16, 2013 at 6:42 am #138901pixelgridParticipant
Html doesnt allow for multiple Id’s on the same element but can be achieved using xml
> If an element has multiple ID attributes, all of them must be treated as IDs for that element for the purposes of the ID selector. Such a situation could be reached using mixtures of xml:id [XMLID], DOM3 Core [DOM-LEVEL-3-CORE], XML DTDs [XML10] and namespace-specific knowledge.June 16, 2013 at 8:03 am #138916CodeGraphicsParticipant
Yes, it’s perfectly ok. Each id is unique. However, I wonder a situation that will require using more than one or two ids for a tag.June 16, 2013 at 8:09 am #138918CrocoDillonParticipant
> Yes, it’s perfectly ok.
Actually, it’s not as @pixelgrid already mentioned.
> The value must not contain any space characters. – [spec](http://www.w3.org/TR/html5/dom.html#the-id-attribute)
You can compare this definition to that of the [class attribute](http://www.w3.org/TR/html5/dom.html#classes), where it’s explicitly states it can contain a set of space separated classes.June 16, 2013 at 9:07 am #138927SenffParticipant
@CodeGraphics: Even if it’s valid or whatnot, any element on a page should only have ONE id, and every id should only appear ONCE on a page.June 16, 2013 at 3:52 pm #138949
Firstly, @CrocoDillon would be right that an id cannot have space-separated values. That was a mistake on my end when I was typing up a response to @Junni. Secondly, the faux-id attribute values I gave to the div with the class attribute are actually quite valid and are an excellent candidate for allowing an element with a class attribute assigned to it to take on the naming conventions of an id. In CSS, it would be styled like so:
Cheers!June 16, 2013 at 5:16 pm #138958Kitty GiraudelParticipant
Hashed classes: troll topic enabled. See http://csswizardry.com/2013/05/hashed-classes-in-css/.June 16, 2013 at 6:49 pm #138960CrocoDillonParticipant
Nice read Hugo :) (especially the conclusion)
- The forum ‘CSS’ is closed to new topics and replies.