布尔玛:你如何将一个按钮放在一个盒子中?

时间:2022-02-28 07:31:10
<div class="box">
 <button class="button">Center me</button>
</div>

<button class="is-center"> is not working.

1 个解决方案

#1


29  

Yes, there is a native way.

是的,有一种本地方式。

Bulma offers has-text-centered class for centering text, inline and inline-block elements.

Bulma提供以文本为中心的类,用于居中文本,内联和内联块元素。

You can use following code:

您可以使用以下代码:

<div class="box has-text-centered">
  <button class="button">Center me</button>
</div>

Demo:

<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.3.2/css/bulma.css" rel="stylesheet"/>
<div class="box has-text-centered">
 <button class="button">Center me</button>
</div>

#1


29  

Yes, there is a native way.

是的,有一种本地方式。

Bulma offers has-text-centered class for centering text, inline and inline-block elements.

Bulma提供以文本为中心的类,用于居中文本,内联和内联块元素。

You can use following code:

您可以使用以下代码:

<div class="box has-text-centered">
  <button class="button">Center me</button>
</div>

Demo:

<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.3.2/css/bulma.css" rel="stylesheet"/>
<div class="box has-text-centered">
 <button class="button">Center me</button>
</div>