Forum Moderators: not2easy
Having an issue with getting css to work with noscript tags.
CSS:
.javascript_alert {
background: #F8FAFC url(img/information.png) center no-repeat;
background-position: 15px 50%; /* x-pos y-pos */
color: red;
text-align: center;
font-weight: bold;
font-size: medium;
padding: 5px 20px 5px 45px;
border-top: 2px solid #B5D4FE;
border-bottom: 2px solid #B5D4FE;
} html:
<noscript><p class="javascript_alert">[Javascript is required to view this Flash movie...]</p></noscript> The problem is that the background image, information.png does not show. All other css info works just fine.
And the code works just fine (including information.png background) if not using noscript.
Any thoughts? Seems as if noscript simply does not allow a background image? Not an expert here so could use some help...
Thanks,
Will
However, modern browsers (IE6, FF2, Op9) do support background-images on elements inside the <noscript> section as you have above.
Apart from checking the path as dreamcatcher suggests, you seem to have a duplication of your background-position properties:
background: #F8FAFC url(img/information.png) center no-repeat;
background-position: 15px 50%; /* x-pos y-pos */
So I'd check to make sure your background is positioned correctly.
Sorry been having PC issues.
Anyhow, thanks for the help.
OK so the code above works just fine as long as it is not applied to a noscript tag. The image path is correct, even tried hard link. Same result.
So I know CSS is fine. It just seems that noscript wont allow the background image. I'm no expert so thought I'd check to see if that is the case.
Very strange...
Thanks again,
Will
It just seems that noscript wont allow the background image.
In short I think that trying to style the NOSCRIPT element directly is problematic and certainly if you want something cross browser it's a no go!
However, styling a container within your NOSCRIPT section appears to be OK, in modern browsers.
Just out of curiosity, given the following HTML:
<noscript class="no-script">
This is directly within a NOSCRIPT section.
<div class="noscript-container">
This is within a DIV in a NOSCRIPT section.
</div>
</noscript>
Then the following CSS...
Styling NOSCRIPT element directly:
Ignored entirely by IE6/7 and Op8/9. FF1.5/2 obeys the 'color' on the whole element, but the background seems to only be applied to direct content (ie. the first line of text - just the linebox), not the text within the DIV (it's not inherited).
noscript {
background:#fcc url(fuzzy_red.gif);
color:#f00;
} Styling a class applied to the NOSCRIPT element:
Ignored entirely by Op8/9. FF1.5/2 same as above. IE6/7 apply the color and background to everything - but only the lineboxes.
.no-script {
background:#cfc url(fuzzy_green.gif);
color:#0f0;
} Styling a container within the NOSCRIPT element:
Works as expected in IE6/7, FF1.5/2 and Op9. But ignored entirely by Op8.
.noscript-container {
background:#ccf url(fuzzy_blue.gif);
color:#00f;
}
So the "[Javascript is required to view this Flash movie...]" text should have the background then right?
Hhhhm yes, IMO it should (in the browsers I've tested)! Providing that scripting is truely disabled and your CSS itself is OK.
Can you see your "[Javascript is required..." text? What browsers/platforms have you tested?
But it does not work in FireFox 2.0.0.8. Bad Firefox! :(
Opera displays it best. The image is displayed transpart like it should be but it has a background in IE6 and does not appear at all in FF. Ouch!
Ready to give up, not big deal. Was just wondering what the heck is happening.
But yes your right the background is appearing only on the div tag and not on the noscript tag itself. Thanks for that!