中文/英文换行总结

阅读: 评论:0

中文/英文换行总结

中文/英文换行总结

html部分

<div class="parent"><p class="p1">湿哒哒大的大大大的大的大大大的大的啊啊大大大啊大大打啊打大大大</p><p class="p2">湿哒哒大的大大大的大的大大大的大的啊啊大大大啊大大打啊打大大大</p><p class="p3">In the usual web development process, by default, long words at the end of the line will open the container, not what we want, what we want should be that the container cannot be opened, and the complete word cannot be forcibly opened, if If the end of the line is a long word, the entire word is wrapped to the next line, just like the word, can automatically wrap, neither support the container, nor force the end of the word, and does not hide the extra letters of the end of the word</p>
</div>

css部分

<style>.parent{width:300px;margin:30px auto;border:1px solid #000;padding:20px 0;}.p1{/*white-space:normal;     !*默认换行*!*/white-space:nowrap;     /*强制不换行*/}.p2{white-space: nowrap;        /*不换行并显示省略号*/text-overflow:ellipsis;overflow:hidden;}.p3{word-wrap:break-word;       /*以单词作为换行依据,换行之后不拆分单词*/text-align: justify;text-indent:2em;            /*缩进两个字符*/}
</style>

文字容器必须要有宽度才能换行

以下是代码效果:

 附上作者链接:

.html

转载于:.html

本文发布于:2024-01-30 05:31:22,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170656388619567.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:英文   中文   换行
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23