Bootstrap正当中心合理不适合使用行flex
我有一个容器,我想集中在行类中的所有内容,但是当我提供正当中心时,它对我的div没有任何影响,是否有理由在行上起作用吗?
<div class="container my-5">
<div class="row justify-content-center">
<hr class="col-4 border-2 border-top border-danger">
<p class="col-4" >Skills and Abilities</p>
<hr class="col-4 border-2 border-top border-danger">
</div>
</div>
任何帮助都将不胜感激。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果仍然不工作,请尝试此
尝试更改
为
Try this
If still not work try to change
to
理想情况下,您应该使用打算由人力资源标签的DIV标签。但是根据您的代码,只需在p标签中添加文本中心类即可。
这是最终输出
,如果您想实现上述结果。然后,不建议您的方法,您可以尝试以下方法:
Ideally you should use div tags intended of hr tags. But as per your code just add text-center class in p tag.
This is the final output
And if you want to achieve the above result. Then your approach is not recommend, you can try this:
您可以为此使用Flexbox或CSS网格。这比在文本后面添加彩色盒子更灵活。
这是html:
这是flexbox解决方案: https://codepen.io of
在这里CSS网格解决方案: https://codepen.io/trys/pen/pen/pen/pen/pen/pen/pen/pen/pen/pen/pen/vjrzpa
You can use either Flexbox or CSS Grid for this. It will be more flexible than adding a colored box behind the text.
Here's the HTML:
Here's the Flexbox solution: https://codepen.io/trys/pen/vjRXLW/
And here the CSS Grid solution: https://codepen.io/trys/pen/vjRzPa
只需将
d-flex
添加到您的容器链接flex boostrap:
Simply add
d-flex
to your containerLink Flex Boostrap : https://getbootstrap.com/docs/4.0/utilities/flex/
这似乎是添加文本中心最简单的,如下所示。
重要的是要确定在引导程序类中实际应用哪些CSS。我建议使用以下Bootstrap类搜索网站
态
It seems the simplest to add text-center as follows.
And it's important to find out which css are actually applied within the bootstrap class. I recommend using the following bootstrap class search site
bootstrapsearch