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>
效果:
文章来自赵启泽博客 http://www.cnblogs.com/zqzjs/ 总结的很棒
如对本文有疑问, 点击进行留言回复!!
清除新版Google Chrome浏览器中表单控件(input,button...)默认的黑色边框
荐 20200714——git/mac配置/项目运行步骤/一些报错
antd 菜单组件 使用时报错:Cannot read property ‘isRootMenu‘ of undefined
CSS|div的style=“background-image: url(img/a.bmp)图片显示不出来
硬件仪表盘账号建立指导(一) --WHQL认证测试结果提交账号(一)
cookie的规范Cookie的不可跨域名性或Cookie与域名的关系
网友评论