【问题标题】:Bootstrap Vue Flex layout issueBootstrap Vue Flex 布局问题
【发布时间】:2021-06-07 06:35:38
【问题描述】:

我正在尝试使用 bootstrap vue 让 div 位于具有 100vh 的容器的基线上,我查看了文档并实施了他们的建议,但 div 没有移动。

<b-container fluid class="header bv-example-row bv-example-row-flex-cols">
      <b-row class="viewport-header" align-v="start">
        <b-col md="12" class="mt-5 text-center">
          <img src="../../image/logo-white.png" alt="" width="25%" />
          <h2
            class="text-white"
            style="text-decoration: underline; margin-top: 10px"
          >
            Friends Like This
          </h2>
          <h2 class="text-white">Out Now</h2>
        </b-col>
      </b-row>
      <b-row align-v="baseline">
        <b-col md="12" class="text-center">
          <h1>The New Single</h1>
          <b-dropdown id="dropdown-1" text="Listen Now" variant="success" class="m-md-2">
            <b-dropdown-item>First Action</b-dropdown-item>
            <b-dropdown-item>Second Action</b-dropdown-item>
            <b-dropdown-item>Third Action</b-dropdown-item>
            <b-dropdown-divider></b-dropdown-divider>
            <b-dropdown-item active>Active action</b-dropdown-item>
            <b-dropdown-item disabled>Disabled action</b-dropdown-item>
          </b-dropdown>
        </b-col>
      </b-row>
    </b-container>

所以你可以看到我将 flex cols 类添加到容器中,然后将基线添加到第二行,它恰好位于屏幕顶部。对于上下文,我将提供标头类,以防我遗漏了一些东西

.header {
    background: url('../image/bg.jpg') no-repeat center center fixed;
    -webkit-background-size: cover;
    -moz-background-size: cover;
     -o-background-size: cover;
    background-size: cover;
    height: 100vh;
 }

【问题讨论】:

    标签: css twitter-bootstrap vue.js bootstrap-vue


    【解决方案1】:

    我不太确定你想要实现什么。我猜你想在第 1 行和第 2 行之间有一个相等的空间。如果是,也许你可以将这些添加到你的标题 css 中。

    .header {
        ...your css
        display: flex;
        flex-direction: column;
        justify-content: space-between;
     }
    

    【讨论】:

    • 像魅力一样工作!谢谢
    猜你喜欢
    • 2012-04-20
    • 1970-01-01
    • 2011-04-24
    • 2019-08-29
    • 2022-10-14
    • 2016-04-22
    • 2019-04-28
    • 2020-12-19
    • 2015-04-11
    相关资源
    最近更新 更多