我試圖居中文本是在圖像的頂部,但似乎無論什麼我也不會居中HTML居中inline-block的
我也用保證金0自動嘗試但沒」也沒有幫助。
#search_box {
\t width: 100%;
\t height: 450px;
\t position: relative;
\t text-align: center;
}
#search_box h1 {
\t display: inline-block;
\t width: 50%;
\t top: 180px;
\t color: white;
\t background-color: red;
\t position: absolute;
}
<div id="search_box">
\t \t \t <img src="images/background_search.jpg" alt="search_box_picture"/>
\t \t \t <h1>SOME TEXT</h1>
\t \t </div>
那麼這個問題是不是在圖像本身的頂部 –
我編輯的代碼。如果你想把文本放在圖像的頂部,只需將文本先放在你的html文件之前,我想他想要圖像背後的圖像 – GvM
。是對的嗎? –