2014-02-27 10 views
0

首先感謝提前,因爲這個網頁已經幫助我學習HTML的進展很多。 我想學習它,所以我可以建立自己的網站,在那裏我可以寫。 這就是問題所在: 我想插入文本到每個Div中,這很適合所有內側的均勻邊距。我不希望它超過給定的參數。當我嘗試時,它總是移動到Div的外面。 我非常感謝,如果有人在那裏幫助。有人可以請弄清楚我如何可以正確地插入文本到DIV?

的index.html

<div id="content"> 

<div id="top_news"> 
<div id="top_news1"></div> 
<div id="top_news2"></div> 
</div> 

<div id="top2_news"></div> 

<div id="top3_news"> 
<div id="top3_news1"> 
<div id="top3_news1_1"></div> 
<div id="top3_news1_2"></div> 
</div> 
<div id="top3_news2"></div> 
<div id="top3_news3"></div> 
</div> 

</div> 

stylesheet.css中

#container { 
width   : 930px; 
margin   : auto; 
background-color : #ffffff; 
} 

#content { 
margin-top  : 7px; 
margin-left  : 10px; 
margin-right  : 10px; 
margin-bottom : 7px; 
border  : 1px solid #d3d3d3; 
width  : 908px; 
} 

#top_news {width:908px; height:250px;} 
#top_news1 {width:453px; border-right:1px solid #d3d3d3; height:250px; float:left;} 
#top_news1:hover {background-color:#fdb38d;} 
#top_news2 {width:454px; height:250px; float:right;} 
#top_news2:hover {background-color:#faf5a2;} 

#top2_news {width:908px; height:225px; border-top:1px solid #d3d3d3;} 
#top2_news:hover {background-color:#70addc;} 

#top3_news {width:908px; height:250px; border-top:1px solid #d3d3d3;} 
#top3_news1 {width:302px; height:250px; border-right:1px solid #d3d3d3; float:left;} 
#top3_news1_1 {width:302px; height:125px;border-bottom:1px solid #d3d3d3;} 
#top3_news1_1:hover {background-color:#d5addd;} 
#top3_news1_2 {width:302px; height:124px} 
#top3_news1_2:hover {background-color:#f0f0f0;} 
#top3_news2 {width:302px; height:250px; border-right:1px solid #d3d3d3; float:left;} 
#top3_news2:hover {background-color:#b7e795;} 
#top3_news3 {width:302px; height:250px; float:left;} 
#top3_news3:hover {background-color:#ff6686;} 

我所遇到的另一個問題,並且由於支持是如此快速和樂於助人,我想在這裏問吧。 我注意到,當我縮小時,Divs移動並且不會留在原來計劃它們的地方。有沒有人有解決方案? 在此先感謝

+0

可以在這裏創建的jsfiddle.net –

+1

看小提琴小提琴:http://jsfiddle.net/w2RXW/ 1 /(我編輯小提琴,以包括更多的文字在divs中)。對我來說看起來很好。你能更具體地說明什麼不起作用嗎? – Flux

回答

0

將帶有填充的p標記內的文本附加到div s後附加填充(擴展默認填充)。要保留箱子尺寸,請將overflow:hidden添加到div或使其可滾動overflow:scroll

DEMO

我希望這是你正在嘗試做的:)

+0

非常感謝:)真的很感謝你的幫助。 – Leon

相關問題