Override a specific css class only for Safari browser
-webkit-appearance is (luckily or not) also supported by Firefox and Edge as mentioned in the mozilla documentation.
Only thing I can imagine to work is to use JavaScript to target the user agent:
function detectBrowser() {
if (navigator.userAgent.includes("Safari")) {
// your code here
}
}
What Safari-specific pure CSS hacks are out there?
I think the question is valid. I agree with the other responses, but it doesn't mean it's a terrible question. I've only ever had to use a Safari CSS hack once as a temporary solution and later got rid of it. I agree that you shouldn't have to target just Safari, but no harm in knowing how to do it.
FYI, this hack only targets Safari 3, and also targets Opera 9.
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Safari 3.0 and Opera 9 rules here */
}
CSS hack for only Safari NOT Chrome?
CSS hacks are property specific to that browser, rather than browser specific to all properties.
Meaning, you may find a hack that can adjust the font in safari and not effect font in other browsers. However, you cannot use CSS hacks to change all properties in a specific browser.
Hope that helps!
Related Topics
Css: How to Select Parent's Sibling
Lesscss Stops Processing Styles
Clear Fix and Uncollapse Margins with CSS Without Side Effects
How to Remove a Specific Bullet Point Within a Ul in CSS
When and How Do Browsers Render <Style> Tag in <Body>
CSS Two Columns with Known Children Width
The Old Center a Image in a Div Issue ( Image Size Variable - Div Size Fixed )
Padding Within Inputs Breaks Width 100%
Stop PHPstorm File Watchers Running Recursively (With Autoprefixer)
Css: Before/After Content with Title
Nightwatch Cannot Find/Click on Dropdown Option
Bootstrap 4 Center Navbar Brand with Collapse
CSS Border-Width:1Px Doesn't Give Me Equally Thin Borders
Default CSS Overriding Media Query