tags:

views:

110

answers:

6

Is there an "invisible" tag in HTML (4) that I can use to make CSS distinctions

tag.myclass tag.mysubclass h1 {  }

without having any visual impact on the HTML rendered?

My background is that I have areas in a form that belong to different groups. As I am opening those in lightboxes (long story involving DOM operations and such, not really important) I don't want to rely on the usual "div class=x" or "span class=y" to style the subsequent elements, as I would have to reset margins here, paddings there, and so on. A layout-neutral wrapping tag would be just what I need in such situations.

+3  A: 

If you want to group elements use a div or a span tag as a wrapper element. Apply your id or class to this, and style it accordingly.

EDIT

There isn't an 'invisible' tag - but margins and padding can be easily reset 'margin: 0; padding: 0;'

codeinthehole
+3  A: 

No, there is not.

(And that's because such an element wouldn't really fit into the rest of HTML. The only reason DIV and SPAN affect the surrounding area is because they're block and inline elements, respectively. What would an 'invisible' element be? If you need something that's completely independent, absolutely (or relatively) position it and give it a higher z-index.)

Sam DeFabbia-Kane
\*cough\* `<font>` tag \*cough\* ;)
Chetan Sastry
Don't resurrect the dead! :)
Pekka
A: 

You can add display: none; to it. That won't display it (obviously).

Ethan Turkeltaub
No, that's not what I mean. I mean a surrounding tag (a wrapper) that in itself has no visibility, but in which all child elements are rendered as if the wrapper were not there.
Pekka
+3  A: 

While all browsers give default styling to many HTML tags, at it's core HTML only describes data, it doesn't format it.

What you're probably looking for is a DIV tag, because no browser gives any default styling to that tag.

Tim Hettler
+2  A: 

I think you want a <fieldset>.

Alan
That usually comes with some borders in the UI from memory... I could be mistaken though...
Damovisa
Yes, I think a fieldset is not "invisible". Still, it would be a good tag to reset and "misuse" for the purpose in question. +1.
Pekka
+1  A: 

I'd say a span tag is as neutral as they come. I don't think there's any browser that applies a margin nor a padding and it just wraps around it's contents.

jeroen