Junior — Middle
What are the main methods of web page layout?
sobes.tech AI
Answer from AI
The main methods of web page layout include:
- Block Layout — using block elements (div, section, etc.) to build the page structure.
- Flexbox — a modern method that allows easy alignment and distribution of space between elements in one dimension (row or column).
- CSS Grid — a powerful tool for creating two-dimensional grids, allowing control over the placement of elements in rows and columns.
- Positioning (position) — absolute, relative, fixed, and static positioning of elements on the page.
- Floating elements (float) — an outdated method for wrapping text around elements, now used rarely.
Example of using Flexbox:
.container {
display: flex;
justify-content: center; /* horizontal alignment */
align-items: center; /* vertical alignment */
}