2011-12-12 13:08, Joergen W. Lang wrote:
I've come across some sites that use the following code in the <head>
section:
<style type="text/css" style="display:none">
It would be interesting to see some sample URLs, as that could let us
find out why they are doing that.
I suspect it is there to either
a) prevent people from exposing their code
How would it do that? The contents of style elements aren't displayed on
the page by default, and they can be inspected using View Source. The
style attribute does not affect the latter at all, and regarding the
former, display: none is the default.
b) prevent search engines from seeing their code
How would it do that? They don't interpret styles at all.
Is there any documentation of this?
In HTML 4.01, a style attribute is disallowed in a <style> element. In
HTML5 drafts, it is allowed, as it is for any element. There is nothing
special here, it means the same as for any other element. But browser
behavior varies.
By default, browsers behave as if display: none were in effect for
<style> elements - and they may even have such a rule in their actual
browser style sheet. If you set the display property to some _other_
value, then the style sheet may become visible.
Using style="display: block" in a <style> element makes the style
visible on my Firefox. On IE, I need to additionally set display: block
for the <head> element. Cf. to appendix D of CSS 2.1 spec which says
head { display: none }
( http://www.w3.org/TR/CSS2/sample.html )
One _possible_ use for <style type="text/css" style="display:none">
would be to prevent rendering of one style element's contents in a
context where it would otherwise be rendered, e.g. under the influence of
head, style { display: block; }
Yucca
______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/