2012-07-04 82 views
4

縮小我有以下的div結構DIV移動時放大和瀏覽器

<div id="wrapper"> 
    <div id="header"> 
      <div id="storeFinder"> 
         /* html goes here */ 
      </div> 
    </div> 
</div> 

現在,當我在或縮小瀏覽器縮放,移動"storeFinder"左/右...

我已經在網上搜索,發現需要一個圍繞"storeFinder"的包裝,以便它不隨<body>移動,並指定min-width也可以解決問題。

在我的情況下,我已經有一個wrapper div和指定min-width也dint幫助我。

在這裏尋找幫助非常糟糕。

#wrapper { 
      background: white; 
      background-position: 50% 0px; 
      width: 984px; 
      margin: 0px auto 0 auto; 
      text-align: center; 
     } 

    #header { 
     width: 960px; 
     height: 60px; 
     margin: 0 5px 2px 5px; 
     text-align: left; 
     background: white; 
     display: block; 
     position: relative; 
    } 

    #storefinderdropdown { 
     position: absolute; 
     top: 8px; 
     float: none; 
     width: 270px; 
     height: 43px; 
     border: 5px solid #F1F1EF; 
     background: #F1F1EF; 
     z-index: 10; 
     margin: 20px 0 0 342px; 
     font-size: 10px; 
     font-weight: bold; 
     text-indent: 3px; 
     padding: 0; 
    } 
+0

+1所有的答案和幫助你們提供... –

+0

請勾選正確的答案。 – xan

回答

1

你正確的CSS代碼Working Jsfiddle here

#wrapper { 
      background: white; 
      background-position: 50% 0px; 
      width: 984px; 
      margin: 0px auto 0 auto; 
      text-align: center; 
     } 

    #header { 
     width: 960px; 
     height: 60px; 
     margin: 0 5px 2px 5px; 
     text-align: left; 
     background: white; 
     display: block; 
     position: relative; 
    } 

    #storeFinder { 
     position: absolute; 
     top: 8px; 
     float: none; 
     width: 270px; 
     height: 43px; 
     border: 5px solid #F1F1EF; 
     background: #F1F1EF; 
     z-index: 10; 
     margin: 20px 0 0 0px; 
     left:342px; 
     font-size: 10px; 
     font-weight: bold; 
     text-indent: 3px; 
     padding: 0; 
    } 
+0

@ patel.milanb:請打勾證明是最接近的答案:) – xan

1

試試這個:

#storefinderdropdown { 
     position: absolute; 
     top: 8px; 
    left: 342px; /*Add This*/ 
     float: none; 
     width: 270px; 
     height: 43px; 
     border: 5px solid #F1F1EF; 
     background: #F1F1EF; 
     z-index: 10; 
     margin: 20px 0 0 0; /* Change This*/ 
     font-size: 10px; 
     font-weight: bold; 
     text-indent: 3px; 
     padding: 0; 
    }​ 

可能,這將是對你有幫助。

+0

沒有幫助... –

相關問題