[CSS]CSS Advanced - CSS Floating
개발관련/CSS/CSS3 2012. 10. 23. 22:57 |출처: http://www.w3schools.com/css/css_float.asp
What is CSS Float?
With CSS float, an element can be pushed to the left or right, allowing other elements to wrap around it.
Float is very often used for images, but it is also useful when working with layouts.
How Elements Float
Elements are floated horizontally, this means that an element can only be floated left or right, not up or down.
A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the containing element.
The elements after the floating element will flow around it.
The elements before the floating element will not be affected.
If an image is floated to the right, a following text flows around it, to the left:
Turning off Float - Using Clear
Elements after the floating element will flow around it. To avoid this, use the clear property.
The clear property specifies which sides of an element other floating elements are not allowed.
Add a text line into the image gallery, using the clear property:
All CSS Float Properties
The number in the "CSS" column indicates in which CSS version the property is defined (CSS1 or CSS2).
Property | Description | Values | CSS |
---|---|---|---|
clear | Specifies which sides of an element where other floating elements are not allowed | left right both none inherit | 1 |
float | Specifies whether or not a box should float | left right none inherit | 1 |
CSS Floating
A simple use of the float property
An image with border and margins that floats to the right in a paragraph
An image with a caption that floats to the right
Let the first letter of a paragraph float to the left
Create an image gallery with the float property
Turn of float - with the clear property
Creating a horizontal menu
Creating a homepage without tables
'개발관련 > CSS/CSS3' 카테고리의 다른 글
[CSS]CSS Advanced - CSS Pseudo-classes (0) | 2012.10.24 |
---|---|
[CSS]CSS Advanced - CSS Aligning Elements (0) | 2012.10.24 |
[CSS]CSS Advanced - CSS Positioning (0) | 2012.10.23 |
[CSS]CSS Advanced - CSS Display (0) | 2012.10.23 |
[CSS]CSS Advanced - CSS Dimension (0) | 2012.10.23 |