The equal-width layout described in this article uses pure CSS to achieve the effect of making each element have the same width without manually setting the element width. 1. Use table-cell to implement (compatible with ie8) <style> body,div{ margin: 0; padding: 0; } .table-layout{ display: table;/*The parent element must be set to table*/ table-layout: fixed;/*This attribute must be present, otherwise the effect will not be achieved*/ width: 50%; margin: 20px auto; } .table-cell-layout{ display: table-cell;/*The child element must be set to table-cell*/ height: 40px; border: 1px solid #666; border-left: none; } .table-cell-layout:first-child{ border-left: 1px solid #666; } </style> <body> <ul class="table-layout"> <li class="table-cell-layout">li1</li> <li class="table-cell-layout">li2</li> <li class="table-cell-layout">li3</li> <li class="table-cell-layout">li4</li> <li class="table-cell-layout">li5</li> </ul> </body> 2. Use flex layout to achieve <style> body,div{ margin: 0; padding: 0; } .flex-layout{ display: flex; width: 50%; margin: 20px auto; } .flex-item{ flex: 1; height: 40px; border: 1px solid #666; border-left: none; } .flex-item:first-child{ border-left: 1px solid #666; } </style> <body> <ul class="flex-layout"> <li class="flex-item">li1</li> <li class="flex-item">li2</li> <li class="flex-item">li3</li> <li class="flex-item">li4</li> <li class="flex-item">li5</li> </ul> </body> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
>>: Getting Started Guide to Converting Vue to React
This article example shares the specific code of ...
1. Install Docker yum install docker #Start the s...
1. golang:latest base image mkdir gotest touch ma...
Table of contents What is a trigger Create a trig...
Table of contents What are immutable values? Why ...
Canal is an open source project under Alibaba, de...
1. Environment VS 2019 16.9.0 Preview 1.0 .NET SD...
1. Introduction to mysqldump mysqldump is a logic...
Table of contents In vue2 In vue3 Notes on setup ...
Copy code The code is as follows: html { overflow...
Writing XHTML demands a clean HTML syntax. Writing...
Table of contents 1. Background Architecture Prob...
Table of contents 1. Simple page example 2.uni-ap...
Table of contents 1. Integrate Ant Design Vue 2. ...
User and Group Management 1. Basic concepts of us...