2016-06-09 27 views
0

我一直在嘗試幾個小時才能在我的全局標題的頂部獲得一個標誌居中和全角。似乎無法弄清楚。我在車軟件程序的工作,並且可能無法編輯正確的事情......居中在標題中的圖像,也使全角

HTML:

<div id="mainContainer" class="container"> 
    <header id="header"> 
     <div id="logo"> 
      <!--START: global_header--> 
      <h1 class="store-name">[storename]</h1> 
      <h3 class="store-slogan">[storeslogan]</h3> 
      <!--END: global_header--> 
     </div> 

CSS:

#logo { 
    max-width: 100%; 
    height: 100%; 
    overflow: hidden; 
} 
#logo img { 
    left: 0; 
    top: 0; 
    bottom: 0; 
    margin-left: auto; 
    margin-right: auto; 
    max-width: 100%; 
    max-height: 100%; 
} 
+0

沒有[mcve]和實際圖像很難提供幫助。 –

+1

我沒有看到你的logo div裏面有任何img元素。你確定它不是一個背景圖片嗎? –

+0

我應該補充一下,這是它一直在做的事情,我希望標識圖像(這是一個佔位符在這一點上)穿過整個容器http://tinypic.com/r/10eg1fc/9 – CaseyU

回答

0

我在Plunker創建了一個例子。使用您爲標題div設置的標識,您還可以添加背景圖片網址以及背景的位置。不知道你想要的文字。

#header { 
    text-align: center; 
    background-image: url('http://placehold.it/360x65'); 
    background-position: center; 
} 


https://plnkr.co/edit/7Gpf8kePPXQ4MfoSXVKh?p=preview