+ 3

what's the difference between HTML align property and CSS float property?

14th Jul 2016, 1:35 PM
romit chahar
romit chahar - avatar
2 Respuestas
+ 7
Align - You use align to align text and other items rather it be left, right, centered, or justified. Align DOES NOT remove the item from the document flow. Float - Floats an object to the left or right and REMOVES it from the document flow. (i.e. A thumbnail image with paragraph text flowing around it -- you will usually need to set some margins on the image so it looks right). You will most likely be using float to lay the page out.
15th Jul 2016, 7:57 AM
Awele Omeligwe
Awele Omeligwe - avatar
+ 6
So, the float property is used to move a lot of blocks (for example your sidebar, your content area etc.) and the HTML align thing you are talking about, you can do the same in CSS in this way. .test{ text-align: right; } The above code mentioned will be CSS and equivalent HTML code will be. <div class="test"> This text will be aligned from right </div>
15th Jul 2016, 7:55 AM
Awele Omeligwe
Awele Omeligwe - avatar