我正在尝试将图标显示为数字后面的背景图像。
<a id="youhavemail" href="messages.php">0</a>
#youhavemail {
background-image: url("images/mail.png");
background-repeat: no-repeat;
background-size: 20px auto;
}
但由于 anchor 标记中只有一个字符(在本例中为“0”),因此它只显示图像的一小部分。
有没有办法拉伸(stretch)包含 anchor 以显示整个背景图像?
最佳答案
#youhavemail {
background-image: url("http://linenwoods.com/images/offline.png");
background-repeat: no-repeat;
background-size: 20px auto;
display: inline-block;
width:20px;
height: 20px;
}
关于css - 使 anchor 标记拉伸(stretch)为其背景图像的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16719550/