Download presentation
Presentation is loading. Please wait.
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.