删除< p>之间的间距 [英] Remove spacing between <p>

查看:104
本文介绍了删除< p>之间的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想删除段落之间的空格,这样我的所有文本之间就没有任何空间,但我不知道应该使用哪种属性。



我知道 line-height ,但是尝试了解不同的值并找不到正确的值。



示例代码:

 < style> 
p
{
margin:0;
padding:0;
font-size:60px;
}
div
{
margin:0;
padding:0;
背景颜色:红色;
}
< / style>
< div>
< p>测试< / p>
< p>测试< / p>
< / div>

代码图片(我想删除test和test之间的空格):



解决方案

该空格不在段落之间。这是给角色本身的空间。类型在它周围有空白(部分地适应上行和下行)。

如果你想删除文本行之间的空间,那么你需要把文本放入同一段落,并调整行高。



但即使如此,请注意,您永远无法得到确切的结果,因为每种字体和字体都会有不同的指标,而且您不会始终知道确切的指标字体将显示在最终用户的屏幕上。使用网络字体会让你的事情更容易预测。

I want to remove the spaces between paragraphs so all my text doesn't have any kind of space between each other, but I don't know which proprety I should use.

I am aware of line-height, but tried messing around with different values and couldn't find the correct one.

Example code:

<style>
p
{
  margin:0;
  padding:0;
  font-size:60px;
}
div
{
  margin:0;
  padding:0;
  background-color:red;
}
</style>
<div>
  <p>test</p>
  <p>test</p>
</div>

Image of code (I want to remove the space between "test" and "test"):

解决方案

That space isn't between the paragraphs. that's the space given to the characters themselves. Type has white space around it (partially to accommodate ascenders and descenders).

If you want to remove the space between the lines of text themselves, then you need to put the text into the same paragraph, and adjust the line height.

But even then, note that you'll never get this exact, as every typeface and font is going to have different metrics, and you won't always know what exact font will be shown on the end-user's screen. Using a web font will make things a bit more predictable for you.

这篇关于删除&lt; p&gt;之间的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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