473,795 Members | 3,215 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

style tag with CDATA... @import...

what does it mean when a style tag gives something like the following?

<style type="text/css" media="screen,p rojection">/*<![CDATA[*/ @import
"/style/monobook/main.css"; /*]]>*/</style>

is this standard?

Xah
xa*@xahlee.org
∑ http://xahlee.org/

Sep 10 '05 #1
8 4092
"Xah Lee" <xa*@xahlee.org > wrote:
what does it mean when a style tag gives something like the following?

<style type="text/css" media="screen,p rojection">/*<![CDATA[*/ @import
"/style/monobook/main.css"; /*]]>*/</style>

is this standard?


Something like that is required for XHTML served as XHTML, but afaik the
syntax used there is wrong, see http://www.hixie.ch/advocacy/xhtml

--
Spartanicus
Sep 10 '05 #2
Spartanicus <in*****@invali d.invalid> writes:
"Xah Lee" <xa*@xahlee.org > wrote:
what does it mean when a style tag gives something like the following?

<style type="text/css" media="screen,p rojection">/*<![CDATA[*/ @import
"/style/monobook/main.css"; /*]]>*/</style>

is this standard?
Something like that is required for XHTML served as XHTML,


<style type="text/css" media="screen,p rojection">
@import "/style/monobook/main.css";
</style>
would be better, surely, even for XHTML as XHTML?

Personally I'd rather use that [1] and risk breaking the page slightly in
Netscape 1 and earlier (as if XHTML and half of HTML 4 wouldn't
confuse them enough), than have the unreadable and unmemorable nested
comment that the various specifications require between them.
but afaik the syntax used there is wrong, see
http://www.hixie.ch/advocacy/xhtml


Indeed. It's not just decade-old cargo cult baggage, it wouldn't even
have worked properly in the few browsers it was necessary for.

So, I suppose in answer to the OP's question, if you see that in the
style tag it means the author was confused.

[1] Actually, I'd just use <link>, and deal with the NS4/IE4 hiding
another way.

--
Chris
Sep 10 '05 #3
Chris Morris <c.********@dur ham.ac.uk> wrote:
>what does it mean when a style tag gives something like the following?
>
><style type="text/css" media="screen,p rojection">/*<![CDATA[*/ @import
>"/style/monobook/main.css"; /*]]>*/</style>
>
>is this standard?


Something like that is required for XHTML served as XHTML,


<style type="text/css" media="screen,p rojection">
@import "/style/monobook/main.css";
</style>
would be better, surely, even for XHTML as XHTML?

Personally I'd rather use that [1] and risk breaking the page slightly in
Netscape 1 and earlier (as if XHTML and half of HTML 4 wouldn't
confuse them enough), than have the unreadable and unmemorable nested
comment that the various specifications require between them.
but afaik the syntax used there is wrong, see
http://www.hixie.ch/advocacy/xhtml


Indeed. It's not just decade-old cargo cult baggage, it wouldn't even
have worked properly in the few browsers it was necessary for.


I think that you are confusing the quoted CDATA construct with the old

<style type="text/css">
<!--
foo{color:white }
-->
</style>

construct meant to prevent very old and by now unusable browsers from
rendering the content of the style and/or script element.

The CDATA construct is based on something else specific to XHTML served
as such IIRC, read Hixie's article for the specifics.

--
Spartanicus
Sep 10 '05 #4
Xah Lee wrote:
what does it mean when a style tag gives something like the following?

<style type="text/css" media="screen,p rojection">/*<![CDATA[*/ @import
"/style/monobook/main.css"; /*]]>*/</style>

is this standard?

Xah
xa*@xahlee.org
∑ http://xahlee.org/


Yes, it is to mark a section as CDATA as described in XHTML 1.0 Appendix
C, however, he is commenting out the CDATA marked section tags.

--
Gus
Sep 10 '05 #5
Spartanicus <in*****@invali d.invalid> wrote:
I think that you are confusing the quoted CDATA construct with the old


Brainfart, sorry.

--
Spartanicus
Sep 10 '05 #6
Gus Richter wrote in message news:5r******** ************@go lden.net...
Xah Lee wrote:
what does it mean when a style tag gives something like the following?

<style type="text/css" media="screen,p rojection">/*<![CDATA[*/ @import
"/style/monobook/main.css"; /*]]>*/</style>

is this standard?


Yes, it is to mark a section as CDATA as described in XHTML 1.0 Appendix
C, however, he is commenting out the CDATA marked section tags.


I thought it should be like this using all the "hacks" needed for older
browsers:

<style type="text/css" media="screen,p rojection"><!--/*--><![CDATA[/*><!--*/
@import "/style/monobook/main.css";
/*]]>*/--></style>

Sep 10 '05 #7
On Sat, 10 Sep 2005 16:12:27 GMT, Spartanicus <in*****@invali d.invalid>
wrote:
The CDATA construct is based on something else specific to XHTML served
as such IIRC, read Hixie's article for the specifics.


Hixie's article is a deliberate bit of poking fun at XHTML - the idea of
how to deal "neatly" with "hiding CSS" when you choose to serve
XHTML-as-XML to an ancient browser, despite the fact you're playing
merry hell with its accept: header.

XHTML needs some careful handling of _scripts_ with a <![CDATA[ ... ]]>
section. But for CSS, just serve rthe stuff and don't worry about it.

Sep 10 '05 #8
Robi wrote:
Gus Richter wrote in message news:5r******** ************@go lden.net...
Xah Lee wrote:
what does it mean when a style tag gives something like the following?

<style type="text/css" media="screen,p rojection">/*<![CDATA[*/ @import
"/style/monobook/main.css"; /*]]>*/</style>

is this standard?


Yes, it is to mark a section as CDATA as described in XHTML 1.0 Appendix
C, however, he is commenting out the CDATA marked section tags.

I thought it should be like this using all the "hacks" needed for older
browsers:

<style type="text/css" media="screen,p rojection"><!--/*--><![CDATA[/*><!--*/
@import "/style/monobook/main.css";
/*]]>*/--></style>


You have some errors and omissions in your code sample.

You are thinking of pre-level 4 browsers that did not understand the
style element, where you would use the HTML comment <!--...--> to
comment out the _embedded_ stylesheet section so that it would not be
set as text. This is not needed for today's browsers. Anyone using
vintage browsers and/or Lynx are probably used to seeing such junk. If
you care enough, then you should not be using XHTML anyway and use HTML
where it is OK to comment out the CSS declarations for the CSS
challenged browsers.

What the original code segment showed is using CSS comment /*...*/ to
comment out the CDATA marked opening tag /* <![CDATA[ */ and the
CDATA marked closing tag /* ]]> */ for some reason, likely that the
author realized that they are not needed for his _external_ stylesheets,
wasn't quite sure and left it there just in case he did need the CDATA
marked tags after all, in which case he would remove the CSS comments.

The following is what XHTML 1.0 Appendix C says on the subject:

Script and Style element contents must be wrapped within a CDATA marked
section to avoid expansion of entities < and & as start of markup and
not to recognize &lt; and &amp; as < and & respectively.

<script>
<![CDATA[
... unescaped script content ...
]]>
</script>

An alternative is to use external script and style documents.

For compatibility with existing HTML 4 user agents, use external style
sheets or external script if either uses < or & or ]]> or --.
Note: The historical practice of "hiding" scripts and style sheets
within comments for backward comptibility is likely to not work as expected.

--
Gus
Sep 11 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2727
by: Bill Davy | last post by:
I am working with MSVC6 on Windows XP. I have created an MSVC project called SHIP I have a file SHIP.i with "%module SHIP" as the first line (file is below). I run SHIP.i through SWIG 1.3.24 to obtain SHIP_wrap.cpp and SHIP.py; the latter contains the line "import _SHIP". I compile SHIP_wrap.cpp and a bunch of files into a DLL which I have the
5
2100
by: Jeremy Clulow | last post by:
Hi I was looking at the source code of a site which had the code below in the <head> section. Could someone please explain whether this is a known and effective way of compensating for browser CSS bugs, and if so, how it works? Thanks,
11
2117
by: Mark | last post by:
Hello I made a site with validated XHTML and CSS. It works fine also. Only in IE i see the site build up without CSS (very fast though) and then the CSS is used to build the page. When i use this it works fine: <link href="styles/site.css" rel="stylesheet" type="text/css" />
1
3439
by: chris | last post by:
Confused somewhat xml newbie. I'm trying to output xml with a CDATA section, using saxutils.XMLGenerator, but the output contains escaped '<' and '>' and '&' from the CDATA element. Shouldn't it be spit out intact? Here's code and output: from xml.sax import saxutils import sys handler = saxutils.XMLGenerator(sys.stdout)
4
2837
by: Schraalhans Keukenmeester | last post by:
I recently discovered the value of tidy for my html adventures. Nice little app. Only one thing is becoming a bit of a drag. If I use tidy to clean up my code, it inserts the following in every <style> segment: e.g. before: <style> p {
18
758
by: sim.sim | last post by:
Hi all. i'm faced to trouble using minidom: #i have a string (xml) within CDATA section, and the section includes "\r\n": iInStr = '<?xml version="1.0"?>\n<Data><!]></Data>\n' #After i create DOM-object, i get the value of "Data" without "\r\n"
4
1518
by: gimme_this_gimme_that | last post by:
I've seen this include at several sites. Is this documented somewhere? Briefly - how does it work? Thanks.
9
3266
by: shapper | last post by:
Hello, Why do some pages I have seen have //<![CDATA[ in the beginning of a script tag before the script itself? Do I need this? Thanks, Miguel
6
4819
by: dkyadav80 | last post by:
Hi sir, I'm new about xml, javascript. I have two selection field(html) first is city and second is state. the city and state values should be store in xml file. when user select city then all city values should display in city selection field and when user select any one city value then this state of this city should be display auto in state selection field without user selection. please solve my prolem. Thank you.
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.