Introduction to flexible layout of responsive layout
The implementation of responsive layout is a very big leap in front-end engineering. Its very flexible moldability allows the same website to show different vitality on different terminal devices. Taking this opportunity today, I would like to share with you and discuss some elastic layout that are commonly used to implement responsive layout methods.
Flexible layout is a very convenient way to implement responsive layout that only relies on CSS styles. It is also the most commonly used method by K to implement responsive layout. Especially now, the pages of e-commerce websites or mobile apps such as Taobao and Taobao can be easily implemented using elastic layout. The following is a copy of Taobao’s mobile app using elastic layout. part of the page.
## As you can see, especially when small icons are arranged or areas are frequently divided, the flexibility The layout is very convenient. Next, K will take you to review the flexible layout (display:flex).
Flexible layout flex is an attribute value of display in CSS. By adding the display:flex; attribute to the parent container, you can achieve flexible layout of its child elements in the parent element. But it should be noted that the display:flex; style will only apply to the parent container and non-generational child containers that add this attribute. In other words, the dialog:flex; attribute on the parent container It will not cause flexible layout for the child elements in its immediate child elements. Generally speaking, a father can only control his son, but not his grandson. If we want to continue using flexible layout in the next layer, we can add the display:flex; attribute to the corresponding child element again to achieve this.
Flexible layout has corresponding attributes on the parent and child elements to regulate the "elasticity" of the child elements in the parent element.
On the parent element, the properties related to flexible layout that we often use mainly include flex-direction, flex-wrap, justify-content, align-items, align-content, These attributes regulate the flexibility of the item in the parent element from the direction of the main axis, whether to wrap, the alignment of the item on the main axis, the alignment of the item on the cross axis, and the alignment of the item on multiple axes.
On child elements, the properties related to flexible layout that we often use mainly include order, flex-grow, flex-shrink, flex-basis, and align-self. Each attribute regulates the flexibility of the project itself from the sorting of the project, the project enlargement ratio, the project reduction ratio, the main axis space occupied by the project, and the alignment of a single project on the cross axis.
You can find the specific attribute values and functions of the above in my blog (). Here I will tell you about some of the confusions I felt at the time.
(1) Main axis and cross axis. In flexible layout, the main axis and the direction of the main axis depend on the attribute value of the flex-direction attribute. It can be in the horizontal direction or the vertical direction, or it can be forward or positive. Reverse, here, friends who are exposed to this concept for the first time should pay attention. Never equate "main axis" with "horizontal forward", although the default value specified in CSS is like this. The cross axis represents the axis perpendicular to the main axis.
(2)Baseline. In the elastic layout, the word "baseline" is also mentioned. The baseline refers to the lower edge of the letter x. The so-called baseline alignment of many attribute values refers to aligning along the lower end of a lowercase x in a row, as if there is always a template for comparison.
(3) Multiple crossing axes. Multiple cross axes is a situation that may occur after the flex-wrap attribute is set to wrap, that is, multiple rows appear in the parent container, and each row has its own axis.
The above is some summary and insights of K on the use of flexible layout methods in implementing responsive layout. Next time, K will continue to discuss with you several other methods of implementing responsive layout.
The above is the detailed content of Introduction to flexible layout of responsive layout. For more information, please follow other related articles on the PHP Chinese website!

Solution to implement multi-project carousel in Bootstrap4 Implementing multi-project carousel in Bootstrap4 is not an easy task. Although Bootstrap...

How to achieve the effect of mouse scrolling event penetration? When we browse the web, we often encounter some special interaction designs. For example, on deepseek official website, �...

The default playback control style of HTML video cannot be modified directly through CSS. 1. Create custom controls using JavaScript. 2. Beautify these controls through CSS. 3. Consider compatibility, user experience and performance, using libraries such as Video.js or Plyr can simplify the process.

Potential problems with using native select on mobile phones When developing mobile applications, we often encounter the need for selecting boxes. Normally, developers...

What are the disadvantages of using native select on your phone? When developing applications on mobile devices, it is very important to choose the right UI components. Many developers...

Use Three.js and Octree to optimize collision handling of third-person roaming in the room. Use Octree in Three.js to implement third-person roaming in the room and add collisions...

Issues with native select on mobile phones When developing applications on mobile devices, we often encounter scenarios where users need to make choices. Although native sel...

Exploring the implementation principle of mouse scrolling events When browsing some websites, you may notice that some page elements still allow scrolling the entire page when the mouse is hovering...


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
