TOP

The Element Box



width, height, box-sizing


.bg_width-height-content {
  box-sizing: border-box;
  width: 300px;
  height: 200px;
  padding: 20px;
  border: 5px dashed gray;
  margin: 20px;
  }

.bg_width-height-content {
  background-color: silver;
  box-sizing: content-box;
  width: 300px;
  height: 200px;
  padding: 20px;
  border: 5px dashed gray;
  margin: 20px;
  }

overflow


This handles the behavior of content in an element when the content is too large to fit within the element's content area.


overflow attributes
visible hidden scroll auto
visible

This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.
This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.

hidden

This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.
This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.

scroll

This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.
This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.

auto

This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.
This is an example. This handles the behavior of content in an element when the content is too large to fit within the element's content area.


padding



border-style




border-width



border-color



border (shortcut property)



border-radius



border-image



margin


The XOXOs are to show where the margins at the top and bottom end. There is no way to visually indicate where the margins are. Applying a 20% margin to the sides of the body element is a nice way to give a website side cushions for breathing space.


Keep in mind that margins can have quirky behavior. Consider if 'collapsing margins' may be causing layout issues if there is some unknown problem. The only time top and bottom margins don't collapse is for floated or abolutely positioned elements. Left and right margins never collapse.





box-shadow



CSS Outlines

These do not effect the spacing or other aspects of anything else on the page, so it is a good tool to help check the layout aspects of your design.

Unlike borders, outline attributes cannot have effects isolated to specific sides; each attributes effects the whole outline. Outline styles are the same as border styles with the addition of 'auto' and the exclusion of 'hidden'. The offset attribute draws a line just outside the border edge by default, but can be pushed beyond the border by a designated length.