HTML DOM cssFloat Property
Complete Style Object Reference
Definition and Usage
The cssFloat property sets where an image or text will appear (float) in another
element.
Syntax
Object.style.cssFloat=left|right|none
|
Possible Values
| Value |
Description |
| left |
The image or text will float to the left in the parent
element |
| right |
The image or text will float to the right in the parent
element |
| none |
The image or the text will be displayed just where it
occurs in the parent element |
Tips and Notes
Note: If there is too little space on a line for the floating element,
it will jump down on the next line, and continue until a line has enough space.
Example
The following example sets the image to float to the left of the text:
<html>
<head>
<script type="text/javascript">
function setFloat()
{
document.getElementById("img1").style.cssFloat="left";
}
</script>
</head>
<body>
<img id="img1" src="logocss.gif" width="95" height="84" />
<p>This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>
<input type="button" onclick="setFloat()"
value="Set image to float to the left" />
</body>
</html>
|
Try-It-Yourself Demos
cssFloat - Set an image to float to the left of a text
Complete Style Object Reference
Use a web development platform that will help you save a lot of time and bring excitement to your daily development work.
It will also create professional best-practices around your code development and team collaboration.
Try Springloops now, the web development platform
 |
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
|
|