【问题标题】:Having difficulty creating a Grid layout using vue-material framework使用 vue-material 框架创建网格布局时遇到困难
【发布时间】:2017-12-28 05:23:37
【问题描述】:

我正在尝试使用 vue-material 框架创建一个四行布局,每行包含两列。

布局应该是响应式的

当视口大小等于或小于 600 像素时,列应相互堆叠。

列应该有这样的正常布局:

未堆叠时的图像。

当我减小屏幕尺寸时,此内容不会堆叠。

Code using vue material

这是代码 | HTML

<div id="app">

  <div class="edit">

    <h1 class="md-display-3">Connect to be more</h1>
    <h2 class="md-subhead">Always be aware of the state of your business </h2>

  </div>

  <div id="canvas">

    <md-layout md-row md-columns id="rightColumn">

      <md-layout md-column>
        <h1 class="" id="entitle">Connect soft documents</h1>
      </md-layout>

        <md-layout md-column>
        <h1 class="" id="entitle">Connect soft documents</h1>
      </md-layout>


    </md-layout>

  </div>



</div>

这是代码 | CSS

.edit {
  text-align: center;
    font-family: Heiti SC;
}

    #entitle {

    line-height: 1.2em;
    }
.md-display-3 {

  font-family: Heiti SC;
}

/*  media queries  */


/*  tablet  */

@media screen and (max-width: 600px) {
  .md-column {
    float: none !important;
    margin: auto;
    text-align: center;
    width: 46%;
  }
}


#rightColumn {
  background-color: aqua;
  font-family: Heiti SC;
}

【问题讨论】:

    标签: html css vue-material


    【解决方案1】:

    你可以这样做。

    Vue.use(VueMaterial)
    
    Vue.config.productionTip = false
    
    new Vue({
      el: '#app',
    })
    @import url('https://cdnjs.cloudflare.com/ajax/libs/vue-material/0.7.4/vue-material.css');
    
    
    #container > .md-layout {
      background-color: white;
      min-height: 100px;
      border-color: black;
      align-items: center;
      justify-content: center;
      /*border-style: dotted;*/
      border-width: 1px;
      padding: 8px;
    }
    
    body {
      background: #eee;
    }
    <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700,400italic">
    <link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.4.2/vue.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue-material/0.7.4/vue-material.js"></script>
    
    
    <div id="app">
      <md-layout id="container">
        
        <md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
          1
        </md-layout>
        
        <md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="50" md-flex-large="50" md-flex-xlarge="50">
          2
        </md-layout>
        
        <md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="50" md-flex-large="50" md-flex-xlarge="50">
          3
        </md-layout>
        
        
        
        <md-layout md-flex-xsmall="50" md-flex-small="50" md-flex-medium="25" md-flex-large="25" md-flex-xlarge="25">
          4
        </md-layout>
        
        <md-layout md-flex-xsmall="50" md-flex-small="50" md-flex-medium="25" md-flex-large="25" md-flex-xlarge="25">
          5
        </md-layout>
        
        <md-layout md-flex-xsmall="50" md-flex-small="50" md-flex-medium="25" md-flex-large="25" md-flex-xlarge="25">
          6
        </md-layout>
        
        <md-layout md-flex-xsmall="50" md-flex-small="50" md-flex-medium="25" md-flex-large="25" md-flex-xlarge="25">
          7
        </md-layout>
        
        <md-layout md-flex-xsmall="50" md-flex-small="50" md-flex-medium="66" md-flex-large="66" md-flex-xlarge="66">
          8
        </md-layout>
        
        <md-layout md-flex-xsmall="50" md-flex-small="50" md-flex-medium="33" md-flex-large="33" md-flex-xlarge="33">
          9
        </md-layout>
        
      </md-layout>
    </div>

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-20
    • 1970-01-01
    • 2021-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多