gpt4 book ai didi

html - Bootstrap div 左右浮动

转载 作者:太空宇宙 更新时间:2023-11-04 07:11:50 24 4
gpt4 key购买 nike

https://codepen.io/milo-boyd/pen/NzebMJ?page=1&

如何将按钮左对齐,图像右对齐? HTML 不会改变。谢谢。

.button {
float:right
}

.img {
float:left
}
<div class="container">
<div class="row">

<div class="col-md-6 text">
<button type="button" class="btn btn-warning button">Warning</button>

</div>

<div class="col-md-6 img">
<img
src="https://www.istockphoto.com/resources/images/PhotoFTLP/img_67920257.jpg"
style="width:100%"/>
</div>

</div>
</div>

最佳答案

试试这个

https://codepen.io/anon/pen/GGPNVw?editors=1100 .

html 没有变化。

.row {
width: 100%;
display: flex;
flex-direction: row-reverse;
-webkit-flex-direction: row-reverse;
justify-content: space-between;
}

.text {
float:left;
}
<div class="container">
<div class="row">
<div class="col-md-6 img">
<img src="https://www.istockphoto.com/resources/images/PhotoFTLP/img_67920257.jpg" style="width:100%"/>
</div>

<div class="col-md-6 text">
<button type="button" class="btn btn-warning button">Warning</button>
</div>
</div>
</div>

关于html - Bootstrap div 左右浮动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51098113/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com