大佬教程收集整理的这篇文章主要介绍了css3 – 如何将两个div并排放置在一起,其中LEFT的大小适合其他占用剩余空间?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
>两个div必须保持在同一行.
>必须优先考虑左边的div.应尽可能多地将文本显示在左侧div中,直到溢出时使用省略号.
>正确的div的文本应该是对齐的.在溢出的情况下,应使用省略号.
>文本是动态的,因此不能使用百分比或固定宽度.
>只需要在基于webkit的浏览器上工作,所以CSS3解决方案是首选.
以下是一些示例图像:
输入
<div class='left'>I should always fit. If not,ellipsis should be used.</div><div class='right'>Right align and fit me if space available here.</div>
产量
输入
<div class='left'>I should always fit. If not,ellipsis should be used. And some more text and more,and more text.</div><div class='right'>Right align and fit me if space available here.</div>
产量
输入
<div class='left'>This text is left aligned.</div><div class='right'>This text is right aligned.</div>
产量
HTML:
<div class="container"> <div class="left">Some Text,Repeat,Some Text,and then: </div> <div class="right">other Text ttt other Text tttother Text tttother Text ttt</div> </div> <p /> <div class="container"> <div class="left">Some Text,</div> <div class="right">other Text ttt other Text tttother Text tttother Text ttt</div> </div> <p /> <div class="container"> <div class="left">Some Text,</div> <div class="right">other Text ttt</div> </div>
CSS:
.container { width: 600px; } .left { max-width: 100%; BACkground:red; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -ms-text-overflow:ellipsis; float: left; } .right { BACkground:yellow; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; -ms-text-overflow:ellipsis; text-align: right; }
最后:
以上是大佬教程为你收集整理的css3 – 如何将两个div并排放置在一起,其中LEFT的大小适合其他占用剩余空间?全部内容,希望文章能够帮你解决css3 – 如何将两个div并排放置在一起,其中LEFT的大小适合其他占用剩余空间?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。