Home > Article > Web Front-end > An introduction to fluid layout, elements, and dimensions in CSS
This article introduces to you an introduction to fluid layout, elements and sizes in CSS. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
1. Several web page layout methods induced by fluid layout
Layout methods | Description | Features | Scenario |
---|---|---|---|
Static Layout | Static Layout, traditional web design, on the web page All element sizes use px as the unit. Regardless of the exact browser size, the page layout is always displayed as it was when the code was originally written. Generally, the minimum width needs to be set | Cannot perform differently according to the user's screen size | Traditional PC web page |
Flow layout | Liquid Layout, the width of page elements is adjusted according to the screen resolution, but the overall layout remains unchanged. Representative work fence system (grid system) | Use percentages for the size of the main divided areas in the web page (used with min-, max- attributes) | Screen resolution changes When, the size of the elements on the page will change but the layout remains unchanged |
Adaptive Layout | Adaptive Layout, use @media to define layouts for different screen resolutions. , that is, create multiple static layouts, each static layout corresponds to a screen resolution range | When the screen resolution changes, the position of the elements in the page will change but the size will not change | - |
Responsive Layout | Responsive Layout, one page can be viewed on all terminals (PCs of various sizes, mobile phones, watches, refrigerator web browsers, etc.) Display satisfactory effects | There will be a layout style under each screen resolution, that is, the element position and size will change | Multi-terminal page |
Flexible Layout | rem/em layout, the size of each element that wraps the text is in em/rem, while the size of the main divided area of the page still uses percentage or px as the unit | The ideal state is that the aspect ratio of all screens is the same as the original design aspect ratio, or similar, perfectly adapted to the mobile terminal |
The so-called "fluid layout" refers to the use of elements Various layout effects achieved by the "flow" feature. Because "flow" itself It has adaptive characteristics, so "fluid layout" is often adaptive. However, "fluid layout" is not the same as "Adaptive layout". "Adaptive structure" is a general term for a type of structure with adaptive characteristics, and "fluid structure" must be narrow Much narrower. For example, the table layout can also be set to 100% adaptive, but the table and "flow" are not together and do not belong to the "fluid layout".
In layman's terms,
is the way to affect the layout of content by setting margin/border/padding inwidth:auto;or formatting wide/high.
Each element has two boxes, an outer box and an inner box (container box). The outer box is responsible for whether the element can be displayed in one line or can only be displayed in a new line; the inner box is responsible for the width, height, and content presentation.
External Box | Container Box | Performance | |
---|---|---|---|
inline | block | size can be defined, multiple | |
block | block | size can be displayed in one line Definition, a single line displays | |
inline | inline | size cannot be defined, a line displays multiple |
The above is the detailed content of An introduction to fluid layout, elements, and dimensions in CSS. For more information, please follow other related articles on the PHP Chinese website!