overflow hidden 隐藏超出元素

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
 *{padding:0px; margin:0px;}
 .d1{width:600px;float:left; display:inline;border:1px solid #CC3300;}
 .d1 dl{float:left;width:600px;}
 .d1 dl dd{width:299px;float:left;height:23px;line-height:23px;margin-top:10px;display:inline;  overflow:hidden;}
 .d1 dl dd span{float:left;width:90px;height:23px;line-height:23px; background-color:#003333; color:#FF0000; text-align:center;}
 .d1 dl dd em{ float:right;display:block;width:200px; margin-top:2px;}
</style>
</head>

<body>
<div class="d1">
    <dl>
        <dd><span>姓名:</span><em>cyf</em><em><select> <option>sss</option> </select> </em> </dd>
        <dd><span>性别:</span><em>nan</em><em><select> <option>sss</option> </select> </em></dd>
       
        <dd><span>年龄:</span><em><select> <option>sss</option> </select> </em> </dd>
        <dd><span>工资:</span><em><select> <option>sss</option> </select> </em></dd>
    </dl>
</div>
</body>
</html>

 

使用overflow: hidden的前提,我想两个标签都应该代表块状的,想span,em本身是行内元素,只能通过display:block 和float:left;强制转换成块,又强制性的在一行,overflow: hidden,使得超出dd宽度的em元素自动隐藏

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值