1. Flex is the abbreviation of Flexible Box, which means "flexible layout" and is used to provide maximum flexibility for the box model. Any container can be specified as a Flex layout. Note that after setting the Flex layout, the float, clear and vertical-align properties of the child elements will become invalid. Elements that use Flex layout are called Flex containers, or "containers" for short. All its child elements automatically become container members, called Flex items, or "items" for short. By default, a container has two axes: the horizontal main axis and the vertical cross axis. The starting position of the main axis (the intersection with the border) is called the main start, and the ending position is called the main end; the starting position of the cross axis is called the cross start, and the ending position is called the cross end. Items are arranged along the main axis by default. The main axis space occupied by a single item is called the main size, and the cross axis space occupied is called the cross size. flex-direction flex-wrap flex-flo justify-content align-items align-content 2. Vertical centering of elements within a block <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>About vertical centering of elements</title> <style> html, body { border: 0; margin: 0; padding: 0; height: 100%; width: 100%; } .div-main { display: flex; align-items: center; justify-content: center; height: 30%; width: 50%; background: #00a2d4; } .sub-span { margin: auto; font-size: xx-large; } </style> </head> <body> <div class="div-main"> <span class="sub-span"> The Goddess of Luo River </div> </body> </html> This is the end of this article about examples of vertically centering sub-elements inside a div using Flex layout. For more information about vertically centering sub-elements inside a div using Flex, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope that everyone will support 123WORDPRESS.COM in the future! |
<<: Various methods to implement the prompt function of text box in html
>>: Analysis of the reasons why MySQL's index system uses B+ tree
How to install flash in Linux 1. Visit the flash ...
Effect picture (the border color is too light, pu...
XHTML is the basis of CSS layout. jb51.net has al...
I'm currently learning about front-end perform...
This article uses examples to explain the princip...
Table of contents 1 Create configuration and data...
Preface Before leaving get off work, the author r...
sftp is the abbreviation of Secure File Transfer ...
Table of contents For example: General writing: S...
This article shares the specific code of writing ...
Table of contents Preface analyze Initial Renderi...
Table of contents TOKEN Timer Refresher 2. Intern...
It's the end of the year and there are fewer ...
This error is often encountered by novices. This ...
The specific code is as follows: package epoint.m...