作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是新来的,所以提前为这个问题道歉......
我正在尝试创建 3 个文本 block ,但将它们水平对齐。我不想创建按钮,只想创建文本 block 。
这个 HTML 似乎不起作用
<div id="boxes">
<h1>EFFICIENT</h1>
<p>Each part of the budget is spent programmatically with a performance objective</p>
<h1>TAILORED</h1>
<p> Each campaign is different and tailored to our clients needs</p>
<h1>DEDICATED</h1>
<p>Our team is fully dedicated to our client with a personalised approach and daily contacts</p>
</div>
和 CSS
#boxes {
height: 300px;
width: 100%;
position: relative;
padding-top: 50px;
padding-bottom: 100px;
}
#boxes h1 p {
float: left;
}
最佳答案
试试这个:
#boxes {
height: 90px;
border: 2px dotted #ee944d;
display: table-cell;
vertical-align: middle;
padding:15px;
}
#boxes h1 p {
float: left;
text-align:left;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
</head>
<body>
<div id="boxes">
<h1>EFFICIENT</h1>
<p>Each part of the budget is spent programmatically with a performance objective</p>
<h1>TAILORED</h1>
<p> Each campaign is different and tailored to our clients needs</p>
<h1>DEDICATED</h1>
<p>Our team is fully dedicated to our client with a personalised approach and daily contacts</p>
</div>
</body>
</html>
关于html - 如何水平对齐内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45522394/
我是一名优秀的程序员,十分优秀!