如何用CSS创建透明边框? [英] How do I make a transparent border with CSS?

查看:169
本文介绍了如何用CSS创建透明边框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 li 的样式如下:

li{
    display:inline-block;
    padding:5px;
    border:1px solid none;
}
li:hover{
    border:1px solid #FC0;
}

当我将鼠标悬停在 li 边框出现,但不会使 li 移动。

When I hover over the li the border appears without making the li's shift around. Is it possible to have a 'border' that's not visible?

推荐答案

您可以使用透明作为颜色。在IE的某些版本中,它是黑色的,但我没有测试它从IE6天。

You can use "transparent" as a colour. In some versions of IE, that comes up as black, but I've not tested it out since the IE6 days.

http://www.researchkitchen.de/blog/archives/css-bordercolor-transparent.php

这篇关于如何用CSS创建透明边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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