2018年的文章移至github上,点我去!2018年的文章移至github上,点我去!2018年的文章移至github上,点我去!

Fork me on GitHub

多个Img标签之间的间隙处理方法

1.多个标签写在一行

<img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/>
<img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/>
<img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/><img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/>

效果前:

效果后:

 

 

2.将要闭合标签的地方与开始标签的地方重合

<img src="/i/eg_tulip.jpg"   alt="郁金香" height="100px"
/><img src="/i/eg_tulip.jpg"   alt="郁金香" height="100px" />

 

3.使用注释头尾相连

<img src="/i/eg_tulip.jpg"   alt="郁金香" height="100px"/><!--
--><img src="/i/eg_tulip.jpg"   alt="郁金香" height="100px" />

 

 

4.在img标签的父级上写:font-size:0;

<div style="font-size:0">
   <img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/>
   <img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/>
</div>

效果:

 

5.使用display:block(img是内联元素)

<img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px" style="display:block"/>
<img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px" style="display:block"/>

效果:

 

6.使用letter-spacing属性

<div style="letter-spacing:-800px"><!--letter-spacing的值无论是负多少都不会产生重叠-->
    <img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/>
    <img src="/i/eg_tulip.jpg"  alt="郁金香" height="100px"/>
</div>        

效果:

 

7.问:为什么<img/>标签之间有间隙,请知道的博友不吝赐教!谢谢。

 

 

 


 

--Log----------------------------------------------------------------------------------------------


2015-10-13  添加操作  添加"将要闭合标签的地方与开始标签的地方重合","使用注释头尾相连"

 


 

posted on 2015-10-10 21:12  qize  阅读(5618)  评论(0编辑  收藏  举报

导航