请参见代码http://jsbin.com/eveqe3/edit,下面也引用了该代码.
我需要以这样的方式显示项目div内的文本,文本只出现在指定宽度的绿色框中,睡觉的行需要隐藏.有什么建议请.
<style>
#container{
width : 220px;
}
.item{
float:left;
border: 1px solid #0a0;
width: 100px;
height: 12px;
padding 2px;
margin: 0px 2px;
}
.clearfix{
clear: both;
}
</style>
</head>
<body>
<div id="container">
<div class="item"> A very loooooooooooooooooooooong text </div>
<div class="item"> Another looooooooooooooooooooong text </div>
<div class="clearfix"> </div>
</div>
</body>
</html>