Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Sayeh Behnam
Sayeh Behnam
1,144 Points

I see a gray border around my image in Safari and Chrome

I created a div with class "translate" and in CSS have image background in it and translated with keyframes- In Safar and Chrome I see a gray border around image (not FireFox) - Already tried border="0px none" Any idea? Here are codes HTML <!DOCTYPE html> <html> <head> <title>CSS Transitions</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body>

<div class="wrap">

    <img class="translate"></img>

</body> </html>


body {

font-family: sans-serif;


.wrap { background: url(img/background.png) no-repeat #fff; margin: 0 auto; width: 774px; height: 416px; cursor: pointer; border: 0px none;

} .translate { width: 259px; height: 173px; position:relative; top:150px; left: 50px; background:url(img/butterfly.png) no-repeat 30% 50% ; border: 0px none; display:block;


@-webkit-keyframes move


20% {-webkit-transform:translate(50px,20px); } 
40% {-webkit-transform:translate(80px,60px); } 
80% {-webkit-transform:translate(90px,70px); } 
100% {-webkit-transform:translate(98px,90px);} 

} @keyframes move {

20% {transform:translate(50px,20px); } 
40% {transform:translate(80px,60px); } 
80% {transform:translate(90px,70px); } 
100% {transform:translate(98px,90px);} 

} }

@-moz-keyframes move {

20% {-moz-transform:translate(50px,20px); } 
40% {-moz-transform:translate(80px,60px); } 
80% {-moz-transform:translate(90px,70px); } 
100% {-moz-transform:translate(98px,90px);}


@-o-keyframes move {

20% {-o-transform:translate(50px,20px); } 
40% {-o-transform:translate(80px,60px); } 
80% {-o-transform:translate(90px,70px); } 
100% {-o-transform:translate(98px,90px);}


.translate:hover { background:url(img/butterfly.gif) no-repeat 30% 50%; border: 0px none; -webkit-animation: move 5s infinite; -moz-animation: move 5s infinite; -o-animation: move 5s infinite; animation: move 5s infinite;


3 Answers

Kevin Korte
Kevin Korte
28,148 Points

I don't know for sure, but it does sound like it's a default webkit browser style that is being added. Are you using normalize.css or some other sort of css reset?

Sayeh Behnam
Sayeh Behnam
1,144 Points

Kevin, It is normalze.Css
I had another sample that used Div Class and added background no border showed I am wondering if it does any thing with Img class - not sure though

Sayeh Behnam
Sayeh Behnam
1,144 Points

I found the answer if any one else has this issue I used <div> class instead of <img> class and the border disappeared looks like Chrome and Safari create a border when has <img class="">