Is there a way to make some CSS rules visible only for Opera (9.5 +)?
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
@certainlyakey works awesome for me:
@media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) { #id {css rule} }
I have a page with a button, and the text would not render correctly in Opera. The button appears many times (add to cart). After applying this fix it worked perfectly.
works great for Opera 10.63
Do not think "detect Opera".
Think "detect browsers that do not support feature x". For example, this JavaScript statement lets you detect browsers that support moz-border-radius:
and this is the equivalent for WebKit-based browsers (Safari, Chrome):
Putting that together, we can come up with something like
CSS:
Caveat: untested :-p
sample here
<link href="opera.css" rel="stylesheet" type="text/opera" media="all" />
Though this solution is rather a CSS hack and there is no guarantee it will be supported in future releases of Opera. You might also consider to use the following solution:
@media all and (-webkit-min-device-pixel-ratio:10000),not all and (-webkit-min-device-pixel-ratio:0) {
.element{/*style for opera only*/}
}
http://bookmarks-online.net/link/1308/css-including-style-for-opera-only
You can use javascript to write out a
<link>
to include a specific CSS file.For Opera 7 you can use this:
However, it's generally bad practice to do styling based on browser-sniffing.