2016-11-23 62 views
0

如何將文本,徽標或任何其他東西放在此橫幅中心,如示例一樣?如何把div放在另一個div裏面的圖片上面?

<div class="banner">  
    <img src="img/banner2.jpg" width="100%" alt="Nasajon Sistemas"> 
</div> 

例子:

enter image description here

我的頁面

enter image description here

+1

的[我如何使用CSS給文字或圖像的透明背景?(可能的複製http://stackoverflow.com/questions/806000/how-do-i-give- text-or-an-image-a-transparent-background-using-css) – esote

+0

在這裏放置圖像 – Vickyexpert

+0

代碼塊周圍的評論是不必要的。 – iblamefish

回答

0

在這裏有你能適應你的需求的例子:

.center{ 
    text-align:center; 
    width:200px; 
    height:100px; 
    background-color:red; 
    position:absolute; 
    top: 50%; 
    left:50%; 
    margin-left:-100px; 
    margin-top:-50px; 
} 

.outter{ 
    width:100%; 
    height: 500px;; 
    background-color:black; 
} 


<div class="outter"> 

    <div class="center"> 
    <h1>Mywebsite</h1> 
    </div> 

</div> 

https://jsfiddle.net/alexcuria/uunwbqyb/

+0

謝謝soo much ^^ –