How to set five column in row with Materialize Design?

…衆ロ難τιáo~ 提交于 2019-12-24 08:02:05

问题


I am using materialize design framework for responsive html page. We can easily manage 2, 3, 4 column in a row. But right now i want to show 5 column in a row.

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css">

  <!-- Compiled and minified JavaScript -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>

<div class="container">
  <div class="row">
    <div class="col l3">
      <img src="https://d2z4fd79oscvvx.cloudfront.net/0023640_black_forest_cake_205.jpeg">
      </div>
      <div class="col l3">
      <img src="https://d2z4fd79oscvvx.cloudfront.net/0023640_black_forest_cake_205.jpeg">
      </div>
      <div class="col l3">
      <img src="https://d2z4fd79oscvvx.cloudfront.net/0023640_black_forest_cake_205.jpeg">
      </div>
      <div class="col l3">
      <img src="https://d2z4fd79oscvvx.cloudfront.net/0023640_black_forest_cake_205.jpeg">
      </div>
      <div class="col l3">
      <img src="https://d2z4fd79oscvvx.cloudfront.net/0023640_black_forest_cake_205.jpeg">
      </div>
      <div class="col l3">
      <img src="https://d2z4fd79oscvvx.cloudfront.net/0023640_black_forest_cake_205.jpeg">
      </div>
      <div class="col l3">
      <img src="https://d2z4fd79oscvvx.cloudfront.net/0023640_black_forest_cake_205.jpeg">
      </div>
    </div>
  </div>

I want to show five image in a row.


回答1:


Try this HTML and CSS for it...

HTML:-

<div class="row-cover"><div class="row-wrap"><div class="row">
      <div class="col s2 offset-s1">1</div>
      <div class="col s2">2</div>
      <div class="col s2">3</div>
      <div class="col s2">4</div>
      <div class="col s2">5</div>
</div></div></div>

CSS:-

.row-cover { overflow: hidden; }
.row-wrap { margin: 0 -8.33333%; }
@media only screen and (max-width: 767px) {
    .row-wrap { margin: 0; }
}

This idea will work for you, you can change the responsiveness for large, medium and small screens as far as your requirement is consent...




回答2:


just add this code in your css file:

 .l3 {
      width:20%;
      float:left;
      }

    .l3 img {
      width:100%;
      max-width:100%;
      object-fit:cover;
      }

@media screen and (max-width: 768px) {
   .l3 {
  width:100%;
  float:left;
  }
}



回答3:


Had this issue the correct and easiest way is...

<div class="tab col m2 s12 offset-m1">
<div class="tab col m2 s12">
<div class="tab col m2 s12">
<div class="tab col m2 s12">
<div class="tab col m2 s12">

obviously within a row



来源:https://stackoverflow.com/questions/39525896/how-to-set-five-column-in-row-with-materialize-design

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!