2015-10-12 16 views
-1

我有一個div和形象,我需要他們在屏幕中間對齊

body { 
 
    margin: 0; 
 
    width: 100%; 
 
    background-color: #292929; 
 
} 
 
.holder { 
 
    width: 66%; 
 
    height: 330px; 
 
    background-color: #412A22; 
 
    position: relative; 
 
    -webkit-box-shadow: 2px 2px 2px 0px #000000; 
 
    -moz-box-shadow: 2px 2px 2px 0px #000000; 
 
    box-shadow: 2px 2px 2px 0px #000000; 
 
    display: inline-block; 
 
} 
 
.holder:before { 
 
    content: ''; 
 
    position: absolute; 
 
    top: 0; left: 0; 
 
    border-top: 50px solid #292929; 
 
    border-right: 50px solid #412A22; 
 
    width: 0; 
 
} 
 
.sidething { 
 
    float: left; 
 
    width: 100px; 
 
    display: block; 
 
}
\t <div class="main"> 
 
\t <div class="holder"> 
 
\t \t <div class="holder-imgs"> 
 
\t \t </div> 
 
\t \t <div class="contact"> \t \t \t 
 
\t \t </div> 
 
\t </div> 
 
\t <img class="sidething" src="Layer%203.png"> 
 
\t </div>

這是我的CSS和HTML,什麼我basicly需要的是中心組圖像和DIV中頁面中間。下面是它看起來像圖像:提前

回答

0

爲什麼不能做一些簡單的像這樣http://imgur.com/IROUUk2

感謝:

<center> 
<div class="main"> 
<div class="holder"> 
    <div class="holder-imgs"> 
    </div> 
    <div class="contact">   
    </div> 
</div> 
<img class="sidething" src="Layer%203.png"> 
</div> 
</center> 

簡單的HTML - 應該做的伎倆!

或者,如果你是主「持有人」格將只包含文字,你可以在下面的屬性添加到「持有」 DIV + CSS:

text-align: center; 

您可能會發現this site有用!

希望這會有所幫助,祝你好運!

相關問題