我們已經(jīng)看過(guò) 中型和大型設(shè)備 ?,F(xiàn)在,讓我們一起看另一個(gè)示例,我們將讓它同樣適用于小型手機(jī)。我們要把平板電腦的列分割為 25%/75%,我們將添加如下選項(xiàng):
<div>....</div> <div>....</div>
現(xiàn)在,給我們提供了 3 種不同的列布局,分別適用于三種設(shè)備。在手機(jī)上,它將是左邊 25% 右邊 75% 的布局。在平板電腦上,它將是 50%/50% 的布局。在大型視口的設(shè)備上,它將是 33%/66% 的布局。請(qǐng)查看下面的示例進(jìn)行驗(yàn)證。(在這里,為每個(gè)列分別定義了樣式,您可以避免這么做。)
<!DOCTYPE html> <html> <head> <title>Bootstrap 示例 - 手機(jī)、平板電腦、臺(tái)式電腦</title> <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js"></script> <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h1>Hello, world!</h1> <div class="row"> <div class="col-sm-3 col-md-6 col-lg-8" style="background-color: #dedef8; box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. </p> </div> <div class="col-sm-9 col-md-6 col-lg-4" style="background-color: #dedef8; box-shadow: inset 1px -1px 1px #444, inset -1px 1px 1px #444;"> <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium. </p> <p> Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. </p> </div> </div> </div> </body> </html>測(cè)試看看 ?/?
結(jié)果如下所示: