Bulma.io中的容器大小

时间:2018-07-29 13:14:41

标签: html css frontend css-position bulma

我已经开始学习布尔玛。我想在x轴上最小化容器(图片中的灰色区域)的大小,以便将元素嵌入其中。找不到文档中的任何相关内容。这是我的源代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" it> 
    <title>Title</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css">
</head>
<body>
<section class="hero is-medium">

    <div class="hero-body has-background-danger">
        <nav class="navbar has-background-primary">
            <div class="container has-background-grey-light is-fluid ">
           </div>
        </nav>
    </div>
</section>
</body>
</html>

这是此代码的示例视图: grey area is the one that I want to minimize

1 个答案:

答案 0 :(得分:6)

您可以将其包装在column类中,然后调整其大小。 (例如is-half

<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="UTF-8" it> 
    <title>Title</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css">
</head>
<body>
<section class="hero is-medium">
    <div class="hero-body has-background-danger">
      <div class="columns is-centered">
       <div class="column is-half">
         <nav class="navbar has-background-primary">
            <div class="container has-background-grey-light is-fluid">
            </div>
         </nav>
       </div>
      </div>
    </div>
</section>
</body>
</html>

结果:

enter image description here