How do I make a transparent border with CSS?

William Calleja picture William Calleja · Mar 24, 2010 · Viewed 217.3k times · Source

I have an li styled as follows:

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

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?

Answer

Douglas picture Douglas · Mar 24, 2010

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