[转]解决层DIV内文字溢出

转载自: http://hi.baidu.com/howchi/blog/item/bf514ae99d314437b80e2d1e.html

 1 <html>
2 <head>
3 <title>层内文字溢出</title>
4 <style type="text/css">
5 <!--
6 body,ul,li,form,p,dl,dt,dd,h1,h2,h3,h4,h5,h6,img{
7 list-style: none;
8 margin: 0;
9 padding: 0;
10 }
11 #layout{
12 margin: 0 auto;
13 width: 600px;
14 }
15 #main{
16 background: #FFEBCD;
17 float: left;
18 width: 400px;
19 height: 500px;
20 }
21 #right{
22 background: #6495ED;
23 float: left;
24 width: 200px;
25 height: 500px;
26 }
27 -->
28 </style>
29 </head>
30 <body>
31 <div id="layout">
32 <div id="main"> </div>
33 <!--注释-->
34 <div id="right">溢出溢出溢出</div>
35 </div>
36 </body>
37 </html>

  将上述代码保存成HTML文件,然后用IE打开浏览时会发现在底部有文字溢出,要解决这个问题,很简单,在该文字层外再嵌套个<DIV>,经测试问题解决。具体如下:

    把body区域改为

     <div id="layout">
   <div id="main"> </div>
   <div><!--注释-->
   <div id="right">溢出溢出溢出</div>
    </div></div>

    此方法适用于各类层内容溢出。

总结: 文字溢出时,在文字外面增加div, 并设置该div的宽度即可实现换行的效果!

转载于:https://www.cnblogs.com/DavidYan/articles/2115193.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值