Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The distinction between block and inline elements always seemed strange to me. The whole difference is that a block element takes up the entire width thus forcing a line break before and after the element, and an inline element only takes up as much as the content. Why not just have one type of element- an inline element where you can also apply custom height/width, and use that? You want line breaks? Insert a <br />, or maybe add a special tag in the CSS for that behavior. The way it's now, I don't see it solving any problem, and instead it only forces a property that in my opinion should be decided by a designer.

So why the two types?

share|improve this question
My favorite part of this question is how it uses an inline style for the <br/>, and a <p> tag to get the last line separated from the first paragraph. Perhaps you should start looking at vast differences in visual intention rather than the differences in implementation. – Stargazer712 Apr 7 '11 at 19:21
While I 100% believe block elements to be useful and disagree with your proposed solution, this is still a great question. – NickC Apr 11 '11 at 22:15
up vote 11 down vote accepted

You say:

You want line breaks? Insert a <br />, or maybe add a special tag in the CSS for that behavior. The way it's now, I don't see it solving any problem, and instead it only forces a property that in my opinion should be decided by a designer.

You are on the right track - style should be decided by the designer.

But, you've got the problem the other way around. Inserting a <br/> tag is actually the option that "forces a property that should be decided by a designer" — inside the markup document, once the <br/> is there, it's there - and only with some tricky/hacky CSS can you remove its effect.

Inline/block elements, on the other hand, are purely elements styled with a convenient default for the common use case. The visual property itself can be changed instantly by a CSS designer with display:inline or display:block.

Take for example the common element for navigation these days - <li>. These are by default block elements, but designers will make them float to appear inline (block has more special properties than just taking up the whole line, but that's a conversation for another day).

share|improve this answer

Most elements have a standard formatting... Your question could be extended to say this formatting should be the decision of the designer as well and should be removed. I always just figured it was a starting point and removed the formatting if needed (often it wasn't). But in the end there's some things that are natural. If you have a paragraph for example you expect it to be a block element because thats the nature of a paragraph. Regardless of whether or not elements have default settings such as block or inline I definitely would either way want the ability to specify this option. The reason I say this is IMO its cleaner to break things this way versus throwing a <br /> in the HTML. Does it do the same thing? Yes. But with recent advances in HTML a large effort was focused on making it more of a semantic language where you put less in the HTML as far as formatting goes and more in the CSS. The <br /> means line break which is typically referring to a line break in a paragraph or other sentence containing structure. In the end it doesn't matter to me but I personally want the ability to have block and inline distinction so I hope they never remove that from the CSS side at least!

share|improve this answer

In LaTeX, there are two modes (not including math mode): the horizontal mode and the vertical mode. The elements (characters) are small boxes that accumulate "horizontally" in paragraph. Then these larger boxes accumulate vertically. This is similar to (X)HTML: inline and block.

share|improve this answer

Sounds like an issue of backward compatibility to me. The inline element was probably a later addition to the HTML standard, and so that web pages written in 1992 can still be viewed in 2011, it is still supported - like there are a ton of 19 year old web pages out there...!

share|improve this answer

This is kind of like saying there is no real difference between paragraphs and sentences. Paragraphs delimit a group of ideas. Typically, a sentence is for a single idea.

The markup is about semantics, not display. Indeed, a designer is free to treat any element that defaults to a block style as inline and vice-versa.

share|improve this answer

I think the modes of display are so different between block and inline, that a distinction worth making at the markup level.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.