然而,只有通過背景圖片/顏色才能連接到瀏覽器左側的側邊欄,然而,無論瀏覽器尺寸如何,內容都保持在正確的位置,並且與其他內容的距離相同,塊居中?左側邊欄擴展水平背景?
我想也許百分比,但其相對於右側欄,這是造成問題..
然而,只有通過背景圖片/顏色才能連接到瀏覽器左側的側邊欄,然而,無論瀏覽器尺寸如何,內容都保持在正確的位置,並且與其他內容的距離相同,塊居中?左側邊欄擴展水平背景?
我想也許百分比,但其相對於右側欄,這是造成問題..
你可以使用一個漫長的邊境線和負利潤來實現這一目標。
http://jsfiddle.net/davidja/TWdXe/2/
.outer {
height:200px;
position:relative;
width:650px; // make your fixed container
margin-left:auto; // center it
margin-right:auto; // center it
}
.inner {
height:200px;
background:red;
width:200px;
display:inline-block;
border-left: solid 1000px red; // long border on the left
margin-left: -1000px; // negative margin to keep the layout
}
.foo {
width:400px;
background:orange;
display:inline-block;
border-right: solid 1000px orange; // long border on the right - optional
margin-right: -1000px; // negative margin to keep the layout - optional
}
body {overflow:hidden;} //Resolves horizontal scrollbar
你有你的HTML/CSS(上的jsfiddle)?我不完全明白。你想在右側對齊整個網站(固定寬度)嗎?然後讓背景填滿左邊的房間? – LinkinTED
就像這樣:http://jsfiddle.net/nickr/TWdXe/? –
黑色放在你的身上。並使.container {寬度:1004px;保證金:0汽車;} tyr這個CSS然後你有你的數據中心在任何瀏覽器 – falguni