br线路高度在safari和铬离开差距 [英] br line-height in safari and chrome leaving gap

查看:102
本文介绍了br线路高度在safari和铬离开差距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的HTML我有一个div和div内,我有不同的垂直间距的文本行。我通过使用断点和定义高度,即< br />< br class =height5/> 或height2或height10或任何其他实现这一点。

In my HTML I have a div and inside the div I have different vertical spacing between lines of text. I achieve this by using breaks and defining the height, i.e. <br /><br class="height5" /> or height2 or height10 or whatever.

在我的样式表中,我将其定义为:

In my stylesheet I define it like:

br.height2 {line-height:2px;}
br.height5 {line-height:5px;}

br.height2 {line-height:2px;} br.height5 {line-height:5px;}

这是在IE6 + FF2 +和Opera的工作,但由于某种原因在Safari和Chrome像这两个浏览器都忽略它,只是应用常规休息)。我试着测试更大的线高度像20px或30px和Safari和Chrome识别这些。他们似乎忽略5-10像素以下的任何东西。

This is working in IE6+ FF2+ and Opera but for some reason there are huge gaps in Safari and Chrome (like those two browsers are ignoring it and just applying regular breaks). I tried testing with larger line-heights like 20px or 30px and Safari and Chrome recognize those. They seem to be ignoring anything under 5-10 pixels.

帮助?感谢!

推荐答案

这项工作适用于Chrome( content 窍门):

This worked on Chrome (the content attribute did the trick):

br {
  content: " ";
  display: block;
  margin: 1em;
}

这篇关于br线路高度在safari和铬离开差距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆