Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 为什么图像会在周围留下缺口?_Html_Css_Image - Fatal编程技术网

Html 为什么图像会在周围留下缺口?

Html 为什么图像会在周围留下缺口?,html,css,image,Html,Css,Image,我想问一下,为什么图像之间会有一个间隙。规范中是否有这种行为 可以看到图像之间的间隙的简单代码: <style>img {width: 100px; height: 100px; background: red;}</style> <img><br> <img><br> <img> img{宽度:100px;高度:100px;背景:红色;} 我知道如何消除这一差距还有更多的可能性: 显示:块

我想问一下,为什么图像之间会有一个间隙。规范中是否有这种行为

可以看到图像之间的间隙的简单代码:

<style>img {width: 100px; height: 100px; background: red;}</style>    

<img><br>
<img><br>
<img>
img{宽度:100px;高度:100px;背景:红色;}


我知道如何消除这一差距还有更多的可能性:

  • 显示:块
  • 浮动
  • 垂直对齐
  • 但我想知道为什么会有这种差距,而不是如何消除这种差距

    有什么想法吗?
    谢谢

    如果图像以内联方式显示,则会在其下方留下一点空间。 这是因为图像放置在文本的基线上,并且 在基线之下,应该有更多的空间用于下降器 像g、j或q这样的字符


    来源:

    小提琴显示nothing@Huangism:真的吗?再次阅读问题:-)代码和小提琴有无效的
    img
    标记,这些标记不涉及任何图像或图像的任何文本替换,因此,在这种情况下提及图像的渲染是毫无意义的。@panther我正确地阅读了这个问题,希望看到间隙,而你的小提琴没有显示间隙,因为它显示了间隙nothing@Huangism:啊,对不起,可能它在chrome中工作,在其他地方可能不工作。答案如下,皮尔斯正确地看到了小提琴。谢谢你的回答和链接。