Using flex layout, if it is a nine-square grid, it can be divided equally, as shown in the figure If we only need eight pieces, as shown in the figure But if we want the last block to be left-aligned and arranged in sequence, we need to add a pseudo-element after to the parent of the element, as shown in the figure <div class="box"> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> ul{ display: flex; flex-wrap: wrap; justify-content: space-between; } ul:after{ content: ""; width: 32%; } ul li{ width: 32%; height: 10vh; margin-bottom: 1vh; background: #2fbaff; } This concludes this article about how to implement left-alignment of the last line in flex box layout. For more flex layout content, please search previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future! |
<<: SQL implementation LeetCode (176. Second highest salary)
>>: Vue implements simple calculator function
Many times, after we install a web service applic...
1. Download https://dev.mysql.com/downloads/mysql...
Record the installation and configuration method ...
CocosCreator version: 2.3.4 Most games have layer...
UCenter Home is an SNS website building system rel...
Written in front Recently, a reader told me that ...
When we are writing projects, we often encounter ...
1. What is CSS Animations is a proposed module fo...
Table of contents 1. What is a doubly linked list...
Table of contents 1 Introduction to user variable...
This article shares the specific code of jQuery t...
Introduction to sudo authority delegation su swit...
Table of contents Overview File Descriptors Synch...
The pitfalls 1. Many tutorials on the Internet wr...
This article example shares the specific code of ...