【发布时间】:2017-08-18 11:51:28
【问题描述】:
我无法让这些数字居中。它们在一个部分内,我尝试了很多变化。一切都是应有的,它们以正确的方式漂浮。但无论我如何尝试使用这些部分或图形代码,它们仍然不在这些部分的中心。
section {
width: 100%;
padding: 1rem;
display: table;
margin: 0 auto;
max-width: none;
background-color: #373B44;
height: 100vh;
}
section:nth-of-type(2n) {
background-color: white;
}
figure.snip1165 {
float: left;
margin: 1rem;
overflow: hidden;
min-width: 150px;
max-width: 300px;
background: #000000;
color: #333;
text-align: left;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}
<section>
<figure class="snip1165">
<img src="http://test.nationalparkpaws.com/images/camping%20in%20mountains%20with%20ten.jpg" />
<figcaption>
<h3>Useful Tips</h3>
<p>
Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.
</p>
</figcaption>
</figure>
<figure class="snip1165 red">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sample63.jpg" alt="sample63" />
<figcaption>
<h3>Caspian<span> Bellevedere</span></h3>
<p>
I don't need to compromise on my principles, because they don't have the slightest bearing on what happens to me anyway.
</p>
</figcaption>
</figure>
<figure class="snip1165 orange">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sample64.jpg" alt="sample64" />
<figcaption>
<h3>Parsley<span> Montana</span></h3>
<p>
That's the problem with nature, something's always stinging you or oozing mucous all over you. Hobbes, I think it is time you and me when and watched some TV.
</p>
</figcaption>
</figure>
</section>
【问题讨论】:
-
垂直或水平或两侧?