1 / 10

Positioning Boxes Using CSS

Positioning Boxes Using CSS. The Box Model. Default margins, borders and padding are all 0.

rlyall
Download Presentation

Positioning Boxes Using CSS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Positioning Boxes Using CSS

  2. The Box Model Default margins, borders and padding are all 0

  3. When you specify the width and height properties of an element with CSS, you are just setting the width and height of the content area. To know the full size of the element, you must also add the padding, border and margin.

  4. The total width of an element should always be calculated like this: • Total element width = width + left padding + right padding + left border + right border + left margin + right margin The total height of an element should always be calculated like this: • Total element height = height + top padding + bottom padding + top border + bottom border + top margin + bottom margin

  5. Box Positioning There are four different positioning methods: • Static (default: positioned according to the normal flow of the page) • Relative (as static, but moved up, down, left, right w.r.t. expected position) • Fixed (with respect to browser window – i.e. does not scroll with the rest of the page) • Float (moves intelligently to fit space)

  6. Static • There's nothing to show – it just happens normally.

  7. Relative

  8. Fixed

  9. Float

  10. Clear: both

More Related