treehouse : what would you like to learn today?
Web Design Web Development iOS Development

How can I hide the default color af a display: block?

  • Hi to all !!!

    I'll paste here my code that I made for a btn... ( the page that I am checking is not on line yet ) but the problem is that the 'div' has borders colored in blue... don't know why... I just would like to hide this borders.. I've tried with border-style: hidden and some more ways...

    #btn{

    background-repeat: no-repeat;
    width:172;
    height:36;
    margin-left:33%;
    margin-top:-20%;
    display: block;


    }


    HTML code:

    <div id=\"btn\">
    <a href=\"http://www.xxx.com\"><img src=\"img/btn.png\"></a>
    </div>


    Thanks so much!! Mc.
  • It's the image that has the border, not the div.

    Add:

    a img {
    border:none;
    }

    to your CSS.
  • Otherwise, the if you give the image an HTML attribute of border="0" it will also remove the border.

    By default, images that are hyperlinked automatically get the blue border (like the blue and underline for hyperlinked text.
  • Fantastic tip!!!

    And the right way is:

    a img {
    border:none;
    }


    Thanks so much !!!