我需要将滚动添加到 div。问题是witch is text中的div必须是百分比。因此,如果名称很长,我需要在父级中滚动它。
HTML:
<div id="list">
<div class="info">
<div class="image">
<img src="https://dl.dropbox.com/u/14396564/no_camera.jpg"> </div>
<div class="text_data">Intell. off. ch. 1 with a very very very long</div>
</div>
<div class="info">
<div class="image">
<img src="https://dl.dropbox.com/u/14396564/no_camera.jpg">
</div>
<div class="text_data">Intell. off.</div>
</div>
</div>
CSS:
#list{
max-height:200px;
overflow-y:auto;
padding:5px;
/*display: none;*/
}
.info{
border: 1px dashed #CCCCCC;
margin-bottom: 5px;
padding:5px;
overflow: hidden;
cursor: pointer;
}
.info .image{
width:20%;
display:inline-block;
margin-right:20px;
/*border: 1px solid red;*/
}
.info .image img{
width: 100%;
}
.info .text_data{
display: inline-block;
/*border: 1px solid green;*/
vertical-align: top;
overflow-x: auto !important;
}