【发布时间】:2023-04-10 04:51:01
【问题描述】:
https://jsfiddle.net/n00q5wdn/
请参考 fiddle 的输出以及我正在链接图像以便更清楚地理解问题。
我只想让“hgroup”垂直居中。
HTML:
<article id="full-height">
<div class="hgroup">
<h1>Exotic Designs</h1>
<h2>Best Quality</h2>
</div>
</article>
SCSS:
#full-height {
background-color: red;
min-height: 600px;
}
.hgroup {
h1 {
color: white;
font-size: 5em;
font-weight: 800;
line-height: 0.8em;
text-shadow: black 0 0 20px;
text-align: center;
}
h2 {
display: block;
color: white;
width: 60%;
max-width: 200px;
margin: 0 auto;
text-align: center;
border: 1px solid white;
margin-top: 15px;
padding: 10px;
background: rgba(0, 0, 0, 0.5);
font-size: 1.3em;
}
}
【问题讨论】:
标签: css alignment vertical-alignment