kajacx
kajacx

Reputation: 12939

HTML: completely useless tag

I need completely dumb tag which does absolutely nothing. div breaks line and I wouldn't like to use span because I will put another elements inside this dump tag and I'm not sure if span is designed to contain other elements.

These two solutions came up to my mind:

  1. Use span anyway
  2. Use completely unused tag

but im not sure how it would work in older browsers.

PS: I already solved my problem by using divs, but I am still curious about this question.

Upvotes: 1

Views: 6683

Answers (2)

Justin
Justin

Reputation: 3397

You could use any element really. The thing you would have to remember is to make the position: fixed; which will take it out of the natural flow and set a z-index: -10;. This would ensure it is always hidden in the background and the other elements would be on top of it.

You didn't specifically mention when you where trying to accomplish so this is just a first-round guess.

Upvotes: 0

What have you tried
What have you tried

Reputation: 11148

Use div with an inline-block attribute? Might do what you need.

div{
display: inline-block;
}

Also, I'd like to address the comments underneath your question.

A <span> would indeed work fine for what you're doing. The only difference between a span and a div is that a div is, by default a block element while a span is an inline element by default. I would still use a div container in your case, however, because to me it makes more sense to wrap elements in a div over a span.

Upvotes: 2

Related Questions