Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Someone has any idea why this code does not work for firefox?

Tags:

html

css

firefox

This code works for chrome as I want but it does not work for firefox.

ul {
    list-style:none; 
}

li {
    display:inline-block;
    border:1px solid black;
}

a {
    display:block;
    margin:10px;
}

a:hover {
    position:relative;
    top:-2px;
    color:red; 
}

and

<ul>
    <li><a href="#">Hi there</a></li>
    <li><a href="#">Hi there</a></li>
    <li><a href="#">Hi there</a></li>
    <li><a href="#">Hi there</a></li>
    <li><a href="#">Hi there</a></li>
</ul>

The problem is that on firefox instead of moving text 2 px up, it moves borders two px down. How can I fix this?

If there is no idea, then, please, suggest another version which will have the same effect on text inside .

like image 492
Karine Avatar asked Dec 03 '25 07:12

Karine


1 Answers

Try changing this:

a { display:block; ... }

to

a { display:inline-block; ... }
like image 93
grc Avatar answered Dec 05 '25 21:12

grc