Why does my close button fluctuate in some browsers?

Please view the demo version: http://jsfiddle.net/cYGzC/

The idea is that when you hover the cross ('×') will wrap around its center, which will give a nice rotational movement when hovering. The problem is that for this to work well, the center x and the center of the circle must match.

.close_button {
    background-color: #3b3b3b;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    box-shadow: 0 0 5px rgba(150,150,150,0.9);
    color: #fff;
    font-size: 40px;
    line-height: 40px;
    text-align: center;
    transition-duration: 2s;
    -webkit-transition-duration: 2s;
    -moz-transition-duration: 2s;
    -o-transition-duration: 2s;
    cursor: pointer;
}

The above CSS trick seems to do the job in many browsers besides Chrome on Windows. (Mac Chrome seems to be working fine.)

+5
source share
2 answers

The short answer is to use an image for your cross. According to Taras, there is no guarantee that fonts will be displayed the same in every browser.

+3

font-family . font-family:Arial, Helvetica, sans-serif;, , firefox

http://jsfiddle.net/cYGzC/1/

0

All Articles