百科问答小站 logo
百科问答小站 font logo



以下 CSS 栅格布局除了用 table 以外,有什么其他的方法吗? 第1页

  

user avatar   Ivony 网友的相关建议: 
      

flexible box,你值得拥有:


       <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head>   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />   <title></title>   <style>       .flex-container       {         display: flex;         flex-direction: column;         flex-wrap: wrap;         height: 440px;         width: 660px;       }          .flex-container section         {           box-sizing: border-box;           padding: 10px;           margin: 10px;           width: 200px;           height: 200px;           border: solid 1px;           border-radius: 5px;         }            .flex-container section:first-child           {             height: 420px;           }   </style> </head> <body>   <section class="flex-container">     <section>A</section>     <section>B</section>     <section>C</section>     <section>D</section>     <section>E</section>   </section>  </body> </html>      

基本上table布局能做到的,flexible box也都能做到,但flexible box的优越性在于可以彻底的分离布局和内容,就像上面这样。




  

相关话题

  为什么在 macOS 下 Chrome 的流畅度比 Safari 差很多? 
  开发web前端为什么用后端node(npm安装模块和webpack打包方式)? 
  乔布斯时代的苹果官网是什么样的? 
  为什么一些公司招前端不想要培训班出来的人? 
  为什么程序都要用英文写,中文不行吗? 
  JavaScript 有必要缓存 for 循环中的 Array.length 吗? 
  算法老师劝学生放弃学习 JavaScript,我该怎么办? 
  为什么 CSS :not 选择器不支持复杂选择? 
  单人做一个网站需要掌握哪些知识? 
  为什么维基百科的用户界面设计不够友好? 

前一个讨论
Java 8的新特性lambda表达式是否比匿名内部类具有更好的可读性?
下一个讨论
为什么苹果能进入中国并且生存得很好,而谷歌却不行?





© 2025-06-12 - tinynew.org. All Rights Reserved.
© 2025-06-12 - tinynew.org. 保留所有权利