HTML CSS examples for CSS Layout:Flex Container
Layout pageable links with flexbox
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .single-line {<!--from w w w . j av a 2 s. co m--> border:solid 1px blue; width:50%; overflow-x:scroll; } .wrap-line { border:solid 1px green; width:50%; } ul { list-style:none; margin:0; padding:0; display: flex; flex-direction: row; justify-content: space-around; } .single-line ul { flex-wrap: nowrap; justify-content: flex-start; } .wrap-line ul { flex-wrap: wrap; align-items: flex-end; } .wrap-line ul li:last-of-type { margin-top: 3em; } li { display:block; width:40px; height:40px; flex-shrink: 0; background:gray; text-align:center; border:solid 1px red; line-height:40px; } </style> </head> <body> <div class="single-line"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> </ul> </div> <br> <div class="wrap-line"> <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> <li>6</li> <li>7</li> <li>8</li> <li>9</li> </ul> </div> </body> </html>