span {display: inline-block;Font-size: 80%;line-height: normal;wIDth: 100%;line-height: 2rem;border: 1px solID #019ed5;border-radius: 25px;cursor: pointer;}解决方法 尝试添加:
display: inline-block;
注意:它可能会改变一些行为.
在HTML中:
<span>JAN-MAR <br /> Q1 Summary</span>
您也可以使用Js,以获得更加动态的方法:
<span >JAN-MAR Q1 Summary</span>
你可以使用jquery来做到这一点:
$(document).ready(function(){ $(".q_header").each(function(){ // Get content var content = $(this).text(),// get first word first_w = content.match(/([\w\-]+)/); // replace the first word with first word and break var new_cnt = content.replace(first_w[0],first_w[0] + "</br>"); // add the CSS to make it inline-block $(this).CSS("display","inline-block").HTML(new_cnt); });});总结
以上是内存溢出为你收集整理的html – 如何在span中插入换行符?全部内容,希望文章能够帮你解决html – 如何在span中插入换行符?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)