Home  >  Q&A  >  body text

css - 链接图片下方的多出的边(横线)如何消除?

PHPzPHPz2766 days ago648

reply all(9)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:05:46

    img{display: block;}

    As the previous friend said, img is an inline element, just convert img into a block element

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 13:05:46

    img is an inline element and has:

        display: inline;

    Similar to text, the baseline is not at the bottom of the container. This can be eliminated by setting the display or font-size attributes

    header > a > img {
        display: inline-block;
        font-size: 0;
    }
    

    You can also change the line-height of its parent element a

    header > a {
        line-height: 0;
    }

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:05:46

    Not border:none?

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:05:46

    I wipe it, isn’t it text-decoration:none;?

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 13:05:46

    Set the style of link a?

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 13:05:46

    a {
        text-decoration: none;
    }

    http://www.w3schools.com/css/css_link.asp
    http://www.w3schools.com/css/tryit.asp?filename=trycss_link_decoration

    reply
    0
  • 迷茫

    迷茫2017-04-17 13:05:46

    Generally, pictures will be displayed directly without underlining. The underline appears because you wrapped the a tag in the image. You can write
    a{
    text-decoration:none;
    }
    in css to eliminate the underline of the a tag

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 13:05:46

    Try adding a CSS reset?

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 13:05:46

    Actually, I want to ask why if you set the background-color here in *{padding:0; margin:0; background-color: #ccc;}, any other tags will be affected.

    reply
    0
  • Cancelreply