CSS Tutorial

CSS Style

CSS Layout Style

CSS Float Style

CSS Reference

CSS float align - set div left, right or center


CSS float property set the elements align to a left side or right side.

CSS Text formatting chapter we learn CSS text-align property set text align left, right or center. Same as float property element or group of element align set either left side or right side.


Example Code:

<body>
	<div style="width:250px;float:right;background-color:orange;">
		<p>This example is content the elements align in left or right side you can set. the paragraph font size is 12 pixel.</p>
	<div>
</body>

Run it...   »

Example Result:


Example Code:

<body>
	<div style="width:250px;float:left;background-color:orange;">
		<p>This example is content the elements align in left or right side you can set. the paragraph font size is 12 pixel.</p>
	<div>
</body>

Run it...   »

Example Result:


Set Float div center

You can set float div center by using margin property. you does not need to use float property but you can use margin property and set left or right margin value auto by this way,

Example Code:

<body>
	<div style="width:250px;background-color:orange;margin:0px auto;">
		<p>This example is content the elements align in center you can set. the paragraph font size is 12 pixel.</p>
	<div>
</body>

Run it...   »

Example Result: