html 响应式网格

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 响应式网格相关的知识,希望对你有一定的参考价值。

@mixin col($width) {
  float: left;
  padding: 15px;
  width: $width + '%';
  border: 1px solid green;
  box-sizing: border-box;
}

.col-1 { @include col(100 / 12);}

.col-2 { @include col(100 / 6);}

.col-3 { @include col(100 / 4);}

.col-4 { @include col(100 / 3);}

.col-5 { @include col(100 * 5 / 12);}

.col-8 { @include col(100 * 2 / 3);}

.col-9 { @include col(100 * 3 / 4);}

.col-10 { @include col(100 * 5 / 6);}

.col-11 { @include col(100 * 11 / 12);}

.col-12 { @include col(100);}
<div class="col-12">
  <h1>Header</h1>
</div>

<div class="col-3">
  <ul>
    <li>Menu 1</li>
    <li>Menu 2</li>
    <li>Menu 3</li>
    <li>Menu 4</li>
  </ul>
</div>

<div class="col-9">
  <h1>Main Content</h1>
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Provident voluptates assumenda omnis tempore molestias soluta, illum dolore eum, velit voluptas, reprehenderit quos id magnam temporibus officia labore fugit nisi aut.</p>
  
  <div class="col-4">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Placeat illo dolorum blanditiis
  </div>
  <div class="col-4">
    Lorem ipsum de soluta cupiditate dolorum ipsam. Magni reiciendis doloremque doloribus.
  </div>
   <div class="col-4">
    Lorem ipsum dolor sit audi eius assumenda illo rerum explicabo ab harum!
  </div>
</div>

以上是关于html 响应式网格的主要内容,如果未能解决你的问题,请参考以下文章

html 响应式六角网格

html 响应式网格

Bootstrap_响应式网格系统

创建响应式布局的10款优秀网格工具集锦

Html/css:使用适合内容宽度的 figcaption 创建响应式图片库网格

响应式网格(栅格化)布局总结