![]() |
VOOZH | about |
We have an element in the HTML document and we will float the elements to the center using CSS.
The CSS float property is used to set or return the horizontal alignment of elements. But this property allows an element to float only right or left side of the parent body with the rest of the elements wrapped around it.
We will use the CSS display property to achieve this.
Example 1: This example set the position of elements exactly at the center of the screen.
Output:👁 Image
Example 2: This example set the position of text float elements exactly at the center of the screen.
Output:
CSS is the foundation of webpages, is used for webpage development by styling websites and web apps. You can learn CSS from the ground up by following this CSS Tutorial and CSS Examples.