-1

My question is where i need to set display:block; to a element? I use in header section and footer but my question i have some box inside images and text there need set display block

header,section,footer{display:block;}

Set it for ul class elements? Where is posible no set display block

.box{display:block;}

2 Answers2

2

Here is brief detail about Inline & Block Elements....

Inline elements:

  1. respect left & right margins and padding, but not top & bottom
  2. cannot have a width and height set
  3. allow other elements to sit to their left and right.

Block elements:

  1. respect all of those
  2. force a line break after the block element

Inline-block elements:

  1. allow other elements to sit to their left and right
  2. respect top & bottom margins and padding
  3. respect height and width

Examples of Block Elements:

<p>, <div>, <form>, <header>, <nav>, <ul>, <li>, and <h1>.

enter image description here

Examples of Inline Elements:

<a>, <span>, <b>, <em>, <i>, <cite>, <mark>, and <code>.

enter image description here

see the good article on display block and inline elements

Shailender Arora
  • 7,674
  • 2
  • 31
  • 35
0

some html elements are block by nature (div, for example). Others are inline (as a, span, ...).

You must use "display:block" only if you need to render an inline element as a block.