2013-04-27 174 views
0

我有一個網站設計,我現在正在嘗試構建,而且我有一個右側的菜單。這是代碼,我會在那之後解釋。在CSS中連接兩個盒子

#rightmenu { 
    border-top: 1px solid #000000; 
    border-right: 1px solid #000000; 
    border-bottom: 1px solid #000000; 
    width:30px;height:578px; 
    border-bottom-right-radius:10px; 
    border-top-right-radius:10px; 
    float:right; 
    margin-top:-580px; 
} 

所以這是這將是在右邊的菜單,我希望它附加到這個盒子,始終走,哪裏就有奇蹟

#content { 
    border-right: 1px solid #000000; 
    border-bottom: 1px solid #000000; 
    border-left: 1px solid #000000; 
    width:800px;height:auto; 
    min-height:400px; 
    margin:0 auto; 
} 

的寬度爲800,它只是在屏幕上居中,所以我需要'右鍵菜單'來附加到居中的內容框。下面是它看起來像在800像素(正確的方法,應該看看): Proper

這是它看起來如果Web瀏覽器的方式是小於800像素(這是最小尺寸的網頁會):

It's hard to see the rightmenu, but if you look closely you can see a line through everything which is it's right border

最後,這裏是如果網站是比800像素更大,將要走的路: enter image description here

回答

1

嘗試包裹他們都在一個div的830px寬,然後將「保證金權:auto;和margin-lef t:auto「屬性。

+0

當我看到那個時候,我覺得自己像一個白癡,我沒有想到這一點,但後來它並沒有像我計劃的那樣工作。 編輯 - 我完全搞砸了,我要再試一次。 – 2013-04-27 02:49:06

+0

想通了,謝謝。 – 2013-04-27 04:58:08

+0

沒問題!很高興它把你送到了正確的道路上! – Dsel 2013-04-27 17:46:44