在A标签上设置宽度和高度 [英] Setting a width and height on an A tag

查看:107
本文介绍了在A标签上设置宽度和高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在锚标签上以像素为单位设置宽度和高度?我想让锚标签具有背景图片,同时保留锚点内的文本。

Is it possible to set the width and height in pixels on an anchor tag? I'd like to have the anchor tag to have a background image while retaining the text inside the anchor.

<li><a href="#">Something</a></li>

li {
   width: 32px;
   height: 32px;
   background-color: orange;
}

li a {
   width: 32px;
   height: 32px;
   background-color: red;
}


推荐答案

display:block ,然后它将接受宽度和高度值。

You need to make your anchor display: block and then it will accept the width and height values.

这篇关于在A标签上设置宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆