CSS Div and CSS Span

CSS Tutorial  >  CSS Div and CSS Span

Div

Div (short for division) divides the content into individual sections. Each section can then have its own formatting, as specified by the CSS. Div is a block-level container, meaning that there is a line feed after the </div> tag.

For example, if we have the following CSS declaration:

.large {
  color: #00FF00;
  font-family:arial;
  font-size: 4pt;
}

The HTML code

<div class="large">
  This is a DIV sample.
</div>

gets displayed as

This is a DIV sample.

Span

Span is similar to div in that they both divide the content into individual sections. The difference is that span goes into a finer level, so we can span to format a single character if needed. There is no line feed after the </span> tag.

For example, if we have the following CSS declaration:

.largefont {
  color: #0066FF;
  font-family:arial;
  font-size: 6px;
}

The HTML code

Span is not at the <span class="largefont">block level</span>.

gets displayed as

Span is not at the block level.

Next: CSS Length Units



Copyright © 2013   1keydata.com   All Rights Reserved   Privacy Policy

CSS Tutorial
CSS Syntax
Apply CSS
CSS Media Types
CSS Cascade
CSS Inheritance
CSS Class ID
CSS Div Span
CSS Length Units

CSS Box Model
CSS Margin
CSS Border
CSS Padding
CSS Background
  CSS Background-attachment
  CSS Background-color
  CSS Background-image
  CSS Background-position
  CSS Background-repeat
CSS Color
CSS Font
CSS Link
CSS List
CSS Table
CSS Position
  CSS Absolute
  CSS Relative
  CSS Fixed
  CSS Static
  CSS Top
  CSS Bottom
  CSS Left
  CSS Right
  CSS Overflow
  CSS Z-Index
CSS Text
CSS Float
CSS Clear
CSS Cursor
CSS Wrap

CSS Codes

Resources

CSS Tutorial German