M
M
Murat Atila2015-04-06 20:54:29
css
Murat Atila, 2015-04-06 20:54:29

Absolute positioning of a pseudo-element?

There is an element with this style

.test {
position: relative;

&:before {
            content: '';
            position: absolute;
            left: 50%;
            top: 50%;
            width: 15px;
            height: 12px;
            background: url('../m/check.png');
            margin: -5px 0 0 -6.5px;
            overflow: visible;
        }

}

In all browsers, except IE9-11, the picture is exactly centered, as it should, why doesn't it work in IE? Who faced it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dima Pautov, 2015-04-06
@bootd

Try like this
margin: -6px 0 0 -7.5px;

D
Deodatuss, 2015-04-06
@Deodatuss

my selectivizr will help or try not through : but through ::

D
Dmitry, 2015-04-06
@soledar10

jsfiddle.net/2bzes8fq
:before works on IE8
htmlbook.ru/css/before
::before works on IE9
htmlbook.ru/css3/before

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question