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:
Example
img
{
float:right;
}
{
float:right;
}
Floating Elements Next to Each Other
If you place several floating elements after each other, they will float next to each other if there is room.
Example
.thumbnail
{
float:left;
width:110px;
height:90px;
margin:5px;
}
{
float:left;
width:110px;
height:90px;
margin:5px;
}
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:
Example
.text_line
{
clear:both;
}
{
clear:both;
}
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
|
Other Topics
CSS : Cross browser compatibality,CSS : Left and right Aligning by float property,CSS : Left &Amp; Right Aligning By Position Property,CSS : Center Aligning By Margin PropertyCSS : Aligning Block Elements,CSS : Float,CSS : All Css Positioning Properties,CSS : Overlapping Elements,CSS : Absolute Positioning,CSS : Fixed Positioning,CSS : Changing How An Element Is Viewed Or Displayed,CSS :Pseudo Classes,CSS :Before pseudo element,CSS :After pseudo element,CSS : Multiple pseudo elements,CSS : pseudo-elements and CSS classes,CSS : First-letter pseudo-element,CSS : First-element
pseudo-element,CSS : Syntax for Pseudo elements,CSS : First-line pseudo-element,CSS : All Css pseudo classes/elements,CSS : The lang pseudo classCSS : MEDIA,CSS::STYLING FORMS, mechanical Engineering, English books,Photoshop tutorials,Harry potter,Best 100 english books,Mechanical-old-question-paper,
No comments:
Post a Comment