css layout methods include: 1. Static layout (Float layout and absolute layout); 2. Adaptive layout; 3. Fluid layout (left fixed, right adaptive, left and right fixed width, middle adaptive, Holy Grail layout, double flying wing layout); 4. Responsive layout; 5. Flexible layout.

The operating environment of this tutorial: Windows7 system, CSS3&&HTML5 version, Dell G3 computer.
We have developed from css to the current major categories that can be summarized into the following categories. The implementation methods you know may be the specific implementations in the following ways:
- Static layout
- Adaptive layout
- Flowing layout (also known as percentage layout%)
- Responsive layout: media query
- Flexible layout (rem/em flex layout)
1. Static layout
The most traditional layout method, all sizes in the web page are in px as the unit, and min-width is set. If the width is less than this width, a scroll bar will appear. If it is greater than this width, the content will be centered and the background will be added. .
Implementation method:
PC: Centered layout, all styles use absolute width/height (px), design a Layout, when the screen width and height are adjusted, use Horizontal and vertical scroll bars to view the obscured parts;
Mobile devices: In addition, create a mobile website, design a separate layout, and use different domain names such as wap. or m.
Advantages: Using the previous CSS2 layout method, the layout is simple and there are no compatibility issues.
Disadvantages: It cannot be displayed reasonably on the mobile phone, and the PC page cannot be used on the mobile phone, so another layout needs to be written to present it.
Practice case:
- Float layout
- Absolute layout
2. Adaptive layout
can be seen as consisting of multiple static layouts under different screens. Adaptive layout defines different layouts for different screen resolutions. Changing the screen resolution can switch between different static layouts (the position of page elements may change), but in each static layout, the page elements do not change as the window size is adjusted. Adaptive layoutThe position of the elements in the page will change, which is a good solution to the disadvantage of low utilization of large screen space in the fluid layout.
When the screen resolution changes, the position of the elements on the page will change but the size will not.
Practical case: Baidu search homepage
(Learning video sharing: css video tutorial)
3. Flow layout
The size of the main divided areas in the web page uses percentage (used with the min-* and max-* attributes) to set the layout format for different screens. When the screen size changes, Different layouts will appear, which means that on this screen, the element block will be in this place, but on that screen, the element block will appear in that place. Only the layout changes, the elements remain unchanged. It can be seen as consisting of multiple static layouts under different screens.
The characteristic of fluid layout is that as the screen changes, the layout of the page does not change significantly and can be adapted and adjusted. This just complements the adaptive layout. Use % percentage to define the width, and the height is mostly fixed in px. It can be adjusted according to the real-time size of the visual area (viewport) and the parent element to adapt to various resolutions as much as possible. Properties such as max-width/min-width are often used to control the size flow range to avoid being too large or too small and affecting reading. This layout method was used in the early history of Web front-end development to cope with PC screens of different sizes (the difference in screen size at that time was not too big), is also used in today's mobile development Commonly used layout methods, buthas obvious shortcomings:The main problem is that if the screen size span is too large, then on a screen that is too small or too large relative to its original design Cannot be displayed normally. Because the width is defined using %, but the height and text size are mostly fixed in px, the display effect on a large-screen mobile phone will become that the width of some page elements is stretched very long, but the height and text size are still the same as the original ones. The same (that is, these things cannot become "flowing"
When the screen resolution changes, the size of the elements on the page will change but the layout will not change.
Main practice cases:
The left side is fixed and the right side is adaptive
The left and right fixed widths are adaptive in the middle
Holy Grail Layout
Double flying wing layout
4. Responsive layout
Responsive design can make the website have a better browsing and reading experience on mobile phones and tablets. Different screen sizes will result in different web page content being displayed to users. Using Media Query can detect the size of the screen (mainly detecting width), and set different CSS styles to achieve responsive layout. Mainly relies on css media queries.
There will be a layout style under each screen resolution, that is, the position and size of elements will change.
Practical case media query
5. Flexible layout
- ##rem/em
- flex layout
Programming Video! !
The above is the detailed content of What are the css layout methods?. For more information, please follow other related articles on the PHP Chinese website!
The Benefits of React: Performance, Reusability, and MoreApr 15, 2025 am 12:05 AMReact’s popularity includes its performance optimization, component reuse and a rich ecosystem. 1. Performance optimization achieves efficient updates through virtual DOM and diffing mechanisms. 2. Component Reuse Reduces duplicate code by reusable components. 3. Rich ecosystem and one-way data flow enhance the development experience.
React: Creating Dynamic and Interactive User InterfacesApr 14, 2025 am 12:08 AMReact is the tool of choice for building dynamic and interactive user interfaces. 1) Componentization and JSX make UI splitting and reusing simple. 2) State management is implemented through the useState hook to trigger UI updates. 3) The event processing mechanism responds to user interaction and improves user experience.
React vs. Backend Frameworks: A ComparisonApr 13, 2025 am 12:06 AMReact is a front-end framework for building user interfaces; a back-end framework is used to build server-side applications. React provides componentized and efficient UI updates, and the backend framework provides a complete backend service solution. When choosing a technology stack, project requirements, team skills, and scalability should be considered.
HTML and React: The Relationship Between Markup and ComponentsApr 12, 2025 am 12:03 AMThe relationship between HTML and React is the core of front-end development, and they jointly build the user interface of modern web applications. 1) HTML defines the content structure and semantics, and React builds a dynamic interface through componentization. 2) React components use JSX syntax to embed HTML to achieve intelligent rendering. 3) Component life cycle manages HTML rendering and updates dynamically according to state and attributes. 4) Use components to optimize HTML structure and improve maintainability. 5) Performance optimization includes avoiding unnecessary rendering, using key attributes, and keeping the component single responsibility.
React and the Frontend: Building Interactive ExperiencesApr 11, 2025 am 12:02 AMReact is the preferred tool for building interactive front-end experiences. 1) React simplifies UI development through componentization and virtual DOM. 2) Components are divided into function components and class components. Function components are simpler and class components provide more life cycle methods. 3) The working principle of React relies on virtual DOM and reconciliation algorithm to improve performance. 4) State management uses useState or this.state, and life cycle methods such as componentDidMount are used for specific logic. 5) Basic usage includes creating components and managing state, and advanced usage involves custom hooks and performance optimization. 6) Common errors include improper status updates and performance issues, debugging skills include using ReactDevTools and Excellent
React and the Frontend Stack: The Tools and TechnologiesApr 10, 2025 am 09:34 AMReact is a JavaScript library for building user interfaces, with its core components and state management. 1) Simplify UI development through componentization and state management. 2) The working principle includes reconciliation and rendering, and optimization can be implemented through React.memo and useMemo. 3) The basic usage is to create and render components, and the advanced usage includes using Hooks and ContextAPI. 4) Common errors such as improper status update, you can use ReactDevTools to debug. 5) Performance optimization includes using React.memo, virtualization lists and CodeSplitting, and keeping code readable and maintainable is best practice.
React's Role in HTML: Enhancing User ExperienceApr 09, 2025 am 12:11 AMReact combines JSX and HTML to improve user experience. 1) JSX embeds HTML to make development more intuitive. 2) The virtual DOM mechanism optimizes performance and reduces DOM operations. 3) Component-based management UI to improve maintainability. 4) State management and event processing enhance interactivity.
React Components: Creating Reusable Elements in HTMLApr 08, 2025 pm 05:53 PMReact components can be defined by functions or classes, encapsulating UI logic and accepting input data through props. 1) Define components: Use functions or classes to return React elements. 2) Rendering component: React calls render method or executes function component. 3) Multiplexing components: pass data through props to build a complex UI. The lifecycle approach of components allows logic to be executed at different stages, improving development efficiency and code maintainability.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

Dreamweaver CS6
Visual web development tools







