我試圖在同一時間在底部和中心位置<div>
。我已經嘗試了許多CSS屬性的組合:margin,top/bottom,margin-top/bottom,absolute/relative/fixed等。同時在一頁的底部和中間位置的位置
據我瞭解,由於外部容器是位置相對的:
header {
position: relative;
min-height: auto;
text-align: center;
color: #fff;
width: 100%;
background-color: #c9c9c9;
background-image: url('shiny-wallpaper-black.jpg');
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
然後我<div>
:
<div style="position: absolute; bottom: 8%; left: 0%; !important">
<div align = Center style=""> Partner with: </div>
<a href="http://www.harveymilton.com">
<img src="assets/harveymilton.png" style="width:50%;height:50%">
</a>
</div>
如果我把position: absolute
然後我得到了<div>
在底部,但不居中。如果我更改position: relative
則<div>
居中,但不在底部。我怎麼能得到這兩個?
你能發送一張圖片來說明你正在嘗試做什麼嗎? –