App下載
首頁(yè)htmlcolumnCSS Layout - 如何使用媒體查詢控制列計(jì)數(shù)

CSS Layout - 如何使用媒體查詢控制列計(jì)數(shù)

我們想知道如何使用媒體查詢控制列計(jì)數(shù)。

The column-count property controls how many vertical columns text will be broken into.

<!DOCTYPE html> <html> <head> <style type='text/css'> article p { -moz-column-rule: 1px solid #ccc; -webkit-column-rule: 1px solid #ccc; column-rule: 1px solid #ccc; -moz-column-gap: 1.5em; -webkit-column-gap: 1.5em; column-gap: 1.5em; } @media only screen and (min-width: 500px) { article p { -moz-column-count: 3; -webkit-column-count: 3; column-count: 3; } } </style> </head> <body> <section> Drag the windows smaller to see 3 columns revert to single column... <article> <p>This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. This is a test. </p> </article> <section> </body> </html>