- This topic is empty.
-
AuthorPosts
-
May 2, 2014 at 7:04 am #169062
jonnow
ParticipantHi,
I’m going to implement svg fallbacks for ie using modernizr (see Chris Coyier’s technique at https://css-tricks.com/svg-fallbacks/) which in short is:
`.my-element { background-image: url(image.svg); } .no-svg .my-element { background-image: url(image.png); } ` However, as I've nested rules with SASS, I'm wondering if there's an easy way to check for the .no-svg class from within a nest? That is, so I don't have to go through and write out a load of CSS (I'm trying to be as lazy as possible!)
Here’s an example of my SASS at the moment:
<code></code>.side-nav { nav { #nav-blog { &:before { background:url(../img/nav/blog.svg) no-repeat 0 8px; } } } } ` `
It would be great if I could just write something like:
`.side-nav { nav { #nav-blog { &:before { background:url(../img/nav/blog.svg) no-repeat 0 8px; } & .. .no-svg &:before { New code here } } } }`
Any ideas would be appreciated! Thanks,
Jonno
May 2, 2014 at 7:10 am #169063Paulie_D
MemberJust to clarify in my mind.
What does .no-svg actually mean?
If you are saying that it doesn’t support SVG images them surely adding the properties in the right order would solve that?
.my-element { background-image: url(image.png); background-image: url(image.svg); }
On the other hand if
.no-svg
means something else that’s a whole other issue.May 2, 2014 at 7:20 am #169065jonnow
ParticipantModernizr carries out the feature detection, if the browser (in this case IE8) doesn’t support svg it adds a class of .no-svg to the…<html> tag.
Let me give that a try…
…ok so I gave that a go but with no luck. I tried taking out the position and repeat in the long hope it would fix it but it hasn’t. Looks like IE is just overwriting the .png with the .svg.
May 2, 2014 at 7:33 am #169068Paulie_D
MemberYeah but my question was…”what does
.no-svg
actually detect.Inline SVG elements or .svg images?
As far as I know `.svg’ is fine for IE9+ : http://caniuse.com/#feat=svg-img
May 2, 2014 at 7:41 am #169074jonnow
ParticipantNot actually sure to be honest. There is another rule apparently, by the name of .no-inline-svg
Unfortunately I’m having to support 7+ D:
Thanks
May 2, 2014 at 8:01 am #169077Paulie_D
MemberUnfortunately I’m having to support 7+ D:
Runs away screaming…
Wait…so no PNG either..or was that IE6?
Insofar as this is a SASS question I don’t think you can apply a ‘parent’ (as it were) class within a specificiation… but I’d have to check.
May 2, 2014 at 8:07 am #169078jonnow
ParticipantPngs seem to be working fine on IE7 and 8
May 2, 2014 at 8:08 am #169079jonnow
ParticipantI think they work in 7 but they’re not without [opacity] issues.
May 2, 2014 at 8:10 am #169080Paulie_D
MemberHmmm…I feel a mixin coming on.
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.