Div and Span

Div

  • Div is a block element
  • Takes as much of the width of the page as it can. It blocks out the whole section of the page, so that anything following it has to go to the next line beneath it.
  • Causes a paragraph break

<html>
<body>
<h1>Krishna's stumble's can be found <div> <a href = "https://krishnakummar.wordpress.com">here</a> <div></h1>
</body>
</html>

Div Tag Output
Div Tag Output

Span

  • Span is an inline element.
  • Takes as little space as possible, only enough to contain its contents.
  • Does not cause any paragraph break, will be inline


<html>
<body>
<h1>Krishna's stumble's can be found <span> <a href = "https://krishnakummar.wordpress.com">here</a> <span></h1>
</body>
</html>

Span Tag Output
Span Tag Output
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s