The CSS float property specifies how an element should float.
The CSS clear property specifies what elements can float beside the cleared element and on which side.
CSS (Cascading Style Sheets) layout techniques are used to control the design and positioning of HTML elements on a web page.
The float property is used for positioning and formatting content e.g. let an image float left to the text in a container.
img {
/* pushes the image to the left of its container/parent */
float: left;
width: 100px;
height: 120px;
}
img {
/* pushes the image to the right of its container/parent */
float: right;
width: 100px;
height: 120px;
}
The foundational concept that treats every HTML element as a rectangular box, consisting of
Defines how elements are rendered:
Specifies the element's placement:
A one-dimensional layout model used for rows or columns:
A two-dimensional layout model for complex layouts:
Older layout techniques:
For responsive design, adapting layouts to different screen sizes.
Using flexible units (%, vw, vh) and frameworks (e.g., Bootstrap) to create layouts that adjust to various devices.