解決方案1:
可以輕鬆地通過table
解決這個問題,只要使用類似這樣的
<table width="100%">
<tr>
<td background="your/image/url5">content...</td>
<td width="950" background="your/image/url">content goes here...</td>
<td background="your/image/url5">content...</td>
</tr>
</table>
你可以使用全部三個區塊寫作合作ntent,也有不同的內容
解決方案2:
如果您需要div
,那麼你需要編寫小的jQuery這個
HTML:
<div class="left"></div>
<div class="center">content goes here...</div>
<div class="right"></div>
css:
<style>
.left{
background:url(your/image);
float:left;
}
.center{
background:url(your/image);
float:left;
width:950px;
}
.right{
background:url(your/image);
float:left;
}
</style>
的jQuery:
<script type="text/javascript">
var window_width = $(window).width(); // get window width
var total_remain = $(window).width()-950; // (-) your center div width
var apply_width = total_remain/2; // get remaining and divide by 2
$(".left").css("width","apply_width"); // appying the width to the right/left
$(".right").css("width","apply_width"); // appying the width to the right/left
</script>
如果一個元素被動態地調整到寬不過它的父是那麼肯定它並不需要對準左邊還是右邊? - 因爲它填補了整個家長? – George
你能不能展示你的代碼以及詳細詢問問題,並且更好的發佈一個圖片也是你想要的結果..... –
你能解釋更多嗎?左邊或右邊的div在邊距內:auto div?張貼您的代碼.. – Dhamu