Chrome and Safari are displaying a border around the image, but I don\'t want one. There is no border in Mozilla. I\'ve looked through the CSS and HTML, and I can\'t find an
To summarise the answers given already: your options to remove the grey border from an img:not([src])
, but still display an image using background-image
in Chrome/Safari are:
Use a different tag that doesn't have this behaviour. (Thanks @Druvision)
Eg: div
or span
.
Sad face: it's not quite as semantic.
Use padding
to define the dimensions. (Thanks @Gonzalo)
Eg padding: 16px 10px 1px;
replaces width:20px; height:17px;
Sad face: dimensions and intentions aren't as obvious in the CSS, especially if it's not an even square like @Gonalo's example.