Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you have a 0.5px border on a Retina Display?

On Mobile Safari on an iPhone 4 or iPhone4S, can you have a border of a div that is 0.5px wide?

like image 629
Drew LeSueur Avatar asked Dec 27 '11 01:12

Drew LeSueur


1 Answers

I use CSS custom properties for this. It is much more elegant (IMHO).

:root {
    --hair:1px;
}

.myDiv {
    border: var(--hair) solid #CCC;
}

@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi),(min-resolution:2dppx) {
    :root {
        --hair:0.5px;
    }
}
like image 141
bizwiz Avatar answered Oct 13 '22 04:10

bizwiz