Tuesday, 12 October 2010

CSS: Hacks in Google Chrome and Safari only...


Here's a nice snippet to use in CSS when it seems like all other browsers are displaying your content correctly besides browsers based on Apple WebKit (Chrome, Safari etc.)

An example of setting css properties in WebKit browsers
/* This works only in Safari and Google Chrome */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    .classNameHere {
        margin: 0 0 1px 0;
        padding: 0px 3px 0px 3px;
    }
    #exampleBorderStyleHere {
        border:solid 1px #000000;
    }
}

No comments: