在div中包含一个段落?

时间:2010-12-23 08:33:40

标签: css html

如何让我的段落在div中?它目前溢出div之外,我不知道如何阻止段落溢出边缘。我不想要滚动条:

overflow: scroll;

和其他溢出选项似乎也没有帮助...我有以下代码:

div {
 width: 1200px;
 margin: 0 auto;
}
.container {
 overflow: hidden;
}
.content {
 width: 1000px;
 float: left;
 margin-left: 0;
 text-align: left;
}
.rightpanel {
 width: 190px;
 float: right;
 margin-right: 0;
 }

<div class="container">
   <div class="content">
   <p>Some content flowing over more than one line</p>
   </div>
   <div class="rightpanel">
   <!-- content -->
   </div>
</div>

编辑:

<div class="container">
<div class="content">
<div class="leftcontent">           
</div>
<div class="newsfeed">
<div class="newsitem">
<p>Full age sex set feel her told. Tastes giving in passed direct me valley as supply. End great stood boy noisy often way taken short. Rent the size our more door. Years no place abode in no child my. Man pianoforte too solicitude friendship devonshire ten ask. Course sooner its silent but formal she led. Extensive he assurance extremity at breakfast. Dear sure ye sold fine sell on. Projection at up connection literature insensible motionless projecting.<br><br>Be at miss or each good play home they. It leave taste mr in it fancy. She son lose does fond bred gave lady get. Sir her company conduct expense bed any. Sister depend change off piqued one. Contented continued any happiness instantly objection yet her allowance. Use correct day new brought tedious. By come this been in. Kept easy or sons my it done.</p>
</div>
</div>
</div>
<div class="rightpanel">
</div>

1 个答案:

答案 0 :(得分:1)

我现在看到了!你给所有的div宽度为1200px。如果你拿走它,一切都会好看。 .newsfeed和.newsitem正在接受这个属性。

你也可以给.newsfeed和.newsitem一个宽度:

.newsfeed , .newsitem { width: 300px; }

例如: http://jsfiddle.net/UZMR2/