« Microsoft ClearType and other powertoys | Main | Barack Obama Gets American Security »

The Difference Between Block-level and Inline Elements

I've been vaguely aware that there's a concept in the world of HTML regarding whether a set of code is block or inline. Thanks to the book I'm currently reading,The Best-Practice Guide to XHTML & CSS, I finally understand-- and can remember-- what the concept means.

Block-level elements treat multiple elements on the page as a single block, putting them all in one rectangular area (think <div>, <table>, and <blockquote>). Inline elements-- and this is the part that's easy to remember-- aren't treated as a block; instead, they fall within lines (ie, "in line") and can go next to other inline elements (think <span>, <a>, and <img>).

One thing to remember is that block elements cannot go inside inline elements.

Post a comment


Type the characters you see in the picture above.