Html 使用“对齐内容”在div上放置按钮
我试图使用justify content将一个按钮放在div的开头,另一个按钮放在末尾 但是我注意到,如果只在div上调用justify内容,那么justify内容是有效的,而不是btn本身,因此下面是我所写的内容,我知道它不起作用 任何提示都将不胜感激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:
<!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;
}