zoukankan      html  css  js  c++  java
  • 多个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>        

    效果:

    后来都会美好的!
  • 相关阅读:
    JS数组(JSON)整合篇-方法整理
    C#匿名对象(转JSON)互转、动态添加属性
    js操作ListBox列表(select)内移动
    w5cValidator【AngularJS】 2.0 版本发布
    {{angular.js 使用技巧}}
    {{angular.js 使用技巧}}
    关于cocoapods添加静态库的奇葩配置
    寻觅[Getting Answers]
    前端和后端开发的异同
    micro-service构建平台
  • 原文地址:https://www.cnblogs.com/momox/p/5047117.html
Copyright © 2011-2022 走看看