我想把我的div放在中心位置。我使用了宽度px,但是只要我将宽度px更改为display:table;我的div去了左边。
background: rgba(225, 245, 245, 0.4);
border-radius: 3px;
bottom: 16px;
display: table;
left: 0;
margin: 0 auto;
padding: 5px;
position: fixed;
right: 0;
text-align: center;

<div id="download">
<span id="description">The National Geographic Explorer passing under the Seal Island Bridge</span>
<a href="'.$filenames[$random_index].'" download="'.$filenames[$random_index].'" title="Download this image. Use of this image is restricted to wallpaper only"download>* Download This Image *</a>
</div>
&#13;
感谢您的帮助。
答案 0 :(得分:0)
使用flexbox
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
#your_div {
display: flex;
justify-content: center;
align-items: center
}