【问题标题】:Vuetify Container max-width fixedVuetify Container 最大宽度固定
【发布时间】:2018-12-13 08:53:30
【问题描述】:

我正在使用 Vue.js 和 Vuetify (https://vuetifyjs.com/en/) 构建一个 Web 应用程序。 我有一个简单的布局,有 3 列。但是,我希望 3 列填充页面的整个宽度,但是有一段自动的 CSS 将 max-width 强制为 960px。这是为什么?如何使用整个屏幕?你也可以在这里查看:https://codepen.io/mlikoga/pen/KeLNvy

<div id="app">
  <v-app>
    <v-content>
      <v-container ma-0 pa-0 fill-height>
        <v-layout row>
          <v-flex xs4> Chat List </v-flex>
          <v-flex xs4> Main Chat</v-flex>
          <v-flex xs4> User Profile</v-flex>
        </v-layout>
      </v-container>
    </v-content>
  </v-app>
</div>

自动 CSS:

@media only screen and (min-width: 960px)
.container {
  max-width: 960px;
}

【问题讨论】:

    标签: css vue.js vuetify.js


    【解决方案1】:

    超级简单的答案: 与上面的答案类似,但在样式中包含 width:100%;因为我的没有它就无法工作。

    <template>
         <v-container fluid style="margin: 0px; padding: 0px; width: 100%">
              <v-layout wrap>
                   <div class="container">
                        Content you want in a container as this takes on the container class.
                   </div>
                   <div>
                        Content you don't want contained as it takes on the fluid 100% width. 
                   </div>
              </v-layout>
         </v-container>
    </template> 
    

    基本上,您覆盖整个默认的 v-container,宽度为 100%。

    【讨论】:

      【解决方案2】:

      容器的概念在网站布局中非常普遍。默认情况下,Vuetify 使用“固定”容器。一个“流体”容器将填充视口。

      您可以在 Vuetify 容器 &lt;v-container&gt; 上将 fluid 属性设置为 true

      <div id="app">
        <v-app>
          <v-content>
            <v-container fluid ma-0 pa-0 fill-height>
              <v-layout row>
                <v-flex xs4> Chat List </v-flex>
                <v-flex xs4> Main Chat</v-flex>
                <v-flex xs4> User Profile</v-flex>
              </v-layout>
            </v-container>
          </v-content>
        </v-app>
      </div>
      

      以下是关于固定容器和流体容器的一些有用信息:https://www.smashingmagazine.com/2009/06/fixed-vs-fluid-vs-elastic-layout-whats-the-right-one-for-you/

      可以在此处找到其他 Vuetify 网格信息: https://vuetifyjs.com/en/layout/grid

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-08-06
        • 2021-04-30
        • 1970-01-01
        • 2013-07-31
        • 2012-07-13
        • 2011-11-08
        • 2015-01-08
        • 1970-01-01
        相关资源
        最近更新 更多