例如我設計了一個邊框樣式的div,並且我設計了另一個div作爲中心,我如何將它設置爲較大div的中心?如何用CSS設置其他div的div中心?
.Profile_Photo_Border {
\t border: 3px solid #052d31;
\t height: 90px;
\t width: 90px;
\t border-radius: 3px;
}
.Profile_Photo {
\t background-color:#005e67;
\t height: 80px;
\t width: 80px;
\t border-radius: 3px;
\t alignment-adjust:middle;
\t text-align:center;
}
\t
<div class="Profile_Photo_Border">
<div class="Profile_Photo"></div>
</div>
謝謝你@Nikhil Batra它很有用,再次感謝 – MojtabaSh
GLad幫助你@MojtabaSh :) –
你應該注意到,這是使用flexbox和不兼容Internet Explorer 8或9,可能不是10. [(source )](http://caniuse.com/#feat=flexbox)如果你需要支持這些瀏覽器,它將不起作用。使用5px的 – GregL