Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使用“对齐内容”在div上放置按钮_Html_Css_Bootstrap 4 - Fatal编程技术网

Html 使用“对齐内容”在div上放置按钮

Html 使用“对齐内容”在div上放置按钮,html,css,bootstrap-4,Html,Css,Bootstrap 4,我试图使用justify content将一个按钮放在div的开头,另一个按钮放在末尾 但是我注意到,如果只在div上调用justify内容,那么justify内容是有效的,而不是btn本身,因此下面是我所写的内容,我知道它不起作用 任何提示都将不胜感激 <!DOCTYPE html> 容器证明 按钮1 按钮2 您可以在更常用的方式中使用内联块元素来执行此操作,如下所示: .d-flex { display: inline-block; width:

我试图使用justify content将一个按钮放在div的开头,另一个按钮放在末尾

但是我注意到,如果只在div上调用justify内容,那么justify内容是有效的,而不是btn本身,因此下面是我所写的内容,我知道它不起作用

任何提示都将不胜感激

<!DOCTYPE html>


容器证明


按钮1
按钮2

您可以在更常用的方式中使用内联块元素来执行此操作,如下所示:

.d-flex {
  display: inline-block;
  width: 100%;
}

.justify-content-start {
  float: left;
}

.justify-content-end {
    float: right;
}

如果需要,您可以更改html页面中的类,我只使用了您提供的类。

在此cae
中,您需要在父级上使用正确的类。在
之间调整内容


按钮1
按钮2

您是否检查了引导中是否有
证明内容
类?
    <div class="d-flex justify-content">
        <button class="btn justify-content-start btn-default">button1</button>


        <button class="btn justify-content-end btn-default">button2</button>    

    </div>
.d-flex {
  display: inline-block;
  width: 100%;
}

.justify-content-start {
  float: left;
}

.justify-content-end {
    float: right;
}