I’m trying to design a link with an image background, question is if the image is too large, how do i fit it to the width and height of the anchor using css?
<a href="#"></a>
<style>
a
{
display: block;
padding: 5px 12px;
border: 1px solid black;
width: 10px;
height: 10px;
background-image: url('/Scripts/images/downarrow_blue.png');
}
</style>
tia,
Lina
Background images in CSS 2.1 cannot be resized, although CSS 3 supports the
background-sizeproperty it’s not widely implemented.The obvious alternative is to just use an
<img>tag:But you probably have a reason for not doing it that way anyway, right?
Other alternatives might be
<a>element to the size of the image instead.