【发布时间】:2019-04-19 21:44:25
【问题描述】:
我的问题是,我无法将文本水平居中对齐。垂直地,我将它对准中心,但水平地,我不能。 (当文本较长时,它水平居中?!如果我没看错的话。)
我尝试添加<a> 元素display:block 和text-align:center,但它没有解决我的问题。
我附上网站的照片。Photo-Click here
<a> 元素位于 <h2> 元素中。
<h2>css:
line-height: 22px;
margin-top: 10px;
margin-bottom: 5px;
font-size: 16px;
height: 55px;
font-weight: 600;
display: flex;
align-items: center;
text-align: center;
<a>-element css:
color: #333;
-webkit-transition: color .5s;
-moz-transition: color .5s;
-ms-transition: color .5s;
-o-transition: color .5s;
transition: color .5s;
我做错了什么?
【问题讨论】:
-
你在使用引导类吗?
-
向我们展示您的 html 代码
-
欢迎来到 Stack Overflow!寻求代码帮助的问题必须包括在问题本身最好在Stack Snippet 中重现它所需的最短代码。见How to create a Minimal, Complete, and Verifiable example
标签: html css twitter-bootstrap flexbox