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的优越性在于可以彻底的分离布局和内容,就像上面这样。