Home Page -> DOM Tutorials -> display values

display values

There are many possible values for display, but the three most important are none, block, and inline. As we mentioned before, setting display to none takes an element out of the page flow entirely; the browser ignores it. The last two of these refer to the context in which HTML displays elements. block elements begin on a new line. Examples are <h1>, <p>, <ol>, and <div>. inline elements are laid out one after the other and flow in line with their surrounding elements. Examples are <b>, <i> and <span>

By changing display appropriately, we can cause a <div> to appear in any of these formatting contexts. Here's an example:


Here is the first sentence.
This sentence is the one whose display will be affected by the buttons below.
This is the third sentence.


  The display property Expanding Text