How to make a border when a hover, so that she did not move?

alt text



    2 answers 2

    set the border in the normal state in the background color, and in the hover in the desired color (in your case in green).

    img {border:1px solid #fff;} img:hover {border:1px solid #000;} 
    • Better not in the background color, but transparent then. border: 1px solid transparent - Cypher
    • border-color: transparent - does not support IE6 - it creates a black border. Taking into account the fact that not everyone abandoned IE6 - it is safer to put it in the background color (if it is homogeneous). - iKuzko
     img{ padding:2px; } img:hover{ padding:0; border:2px solid #000; } 

    Try this