CSS allows you to 'wrap' an element around other. You can do this with the float
property.
This property shifts an item horizontally, left or right from its original placement, leaving a blank space in the opposite direction, which will be filled by the next HTML element. But the elements before the floating element will not be affected.
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 parent.
If you place several floating elements after each other, they will float next to each other if there is room.
<style> #dv1 { width: 200px; float: right; border: 2px solid green; } #dv2 { width: 200px; float: left; border: 2px solid blue; } </style> <h4>Example float</h4> <div id='dv1'>DIV 1, with float: right;</div> <div id='dv2'>DIV 2, with float: left;</div> Text content after the floated DIVs.
Absolutely positioned elements ignores the float property.
The clear
property has an action similar to <br> HTML tag that moves to a new row the next element.
When an element is floated it leaves an empty space in the oposite direction. With the 'clear' property can be avoided the filling of that blank space by the next item.
The clear property is used to insert a break when encountering a new section of the layout to stop the wrapping effect. It specifies which sides of an element other floating elements are not allowed.
<style> #dv1 { width: 200px; float: right; border: 2px solid green; } #dv2 { clear: right; width: 200px; float: left; border: 2px solid blue; } </style> <h4>Example CSS clear</h4> <div id='dv1'>DIV 1, with float: right;</div> <div id='dv2'>DIV 2, with float: left;</div> <br style='clear:both'> Text content after the floated DIVs.
<ul> <li>http://coursesweb.net/html/</li> <li>http://coursesweb.net/css/</li> </ul>
.some_class { display: list-item; }
var obj = { "courses": ["php", "javascript", "ajax"] }; var jsonstr = JSON.stringify(obj); alert(jsonstr); // {"courses":["php","javascript","ajax"]}
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>'; $dochtml = new DOMDocument(); $dochtml->loadHTML($strhtml); $elm = $dochtml->getElementById("dv1"); echo $elm->nodeValue; // CoursesWeb.net