有一個以h2爲中心的圖像,並希望它下面的列表也居中。一直在掙扎了一個多小時,似乎沒有得到它的任何地方。有什麼建議麼?居中一個無序列表
.images {
display: inline-block;
text-align: center;
width: 33%;
/* all ements align to the largest element within the div */
vertical-align: top;
}
.images ol {
width: 70%;
}
.images ol li {
line-height: 1.2em;
border: 0;
}
<div class="images">
<h3>Panacotta Vanilla</h3>
<img src="photo1.png.png">
<p>recipe ingridients</p>
<ol>
<li>Macro free Ranged Chicken</li>
<li>Cover chicken in almond meal</li>
<li>Add cayenne pepper, chilli flakes, mixed herbs and paprika</li>
<li>Cook until all pink of chicken disappears Salad
</li>
</ol>
</div>
的可能的複製[如何水平居中未知寬度的無序列表?(https://stackoverflow.com/questions/1695175/how-to-horizontally-center-an -unordered-list-of-unknown-width) – Rob