[英]How to align center + left/right
My example: 我的例子:
<div class="container">
<div class="d-flex justify-content-between">
<div class="col justify-content-center flex-column d-flex">
left
</div>
<div class="col justify-content-center flex-column d-flex right">
<a href="/">right</a>
</div>
</div>
</div>
.container div {
height: 100px;
background-color: red;
}
a {
background-color: blue;
}
.right {
text-align: right;
}
Fiddle: https://jsfiddle.net/lawagabi/f7tp3x26/1/ 小提琴: https : //jsfiddle.net/lawagabi/f7tp3x26/1/
How can I make text-align right in box with right without expanding it to the entire width? 如何在框中右对齐文本,而不将其扩展到整个宽度?
Your .container div
class is having an affect here. 你的
.container div
类在这里有影响。 Wrap your anchor tag with a span with the right
class to easily fix this. 用
right
类包装你的锚标签,以便轻松解决这个问题。
<div class="container">
<div class="d-flex justify-content-between my-auto">
<div class="col justify-content-center flex-column d-flex">
left
</div>
<div class="col justify-content-center flex-column d-flex">
<span class="right"><a href="/">right</a></span>
</div>
</div>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.