CDATA sessions

Discussion in 'CSS' started by AdamSee, Oct 12, 2006.

  1. #1
    I've seen people using CDATA sessions in their external stylesheets
    
    
    /*<![CDATA[
    
    .wrapper	{width:768px; text-align:left; margin:0 auto}
    .background		{background:#999}
    
    /*]]>*/
    Code (External Stylesheet example):
    My question is why?

    I understand the use for inline styling to keep the markup valid and non-parsing in XHTML. However having it in external documents being sent as text/css will not be treated as xhtml anyway, so the use of CDATA seems redundant?
     
    AdamSee, Oct 12, 2006 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    Isn't that just a comment in CSS? Browsers will ignore that.
     
    SoKickIt, Oct 13, 2006 IP
  3. penagate

    penagate Guest

    Messages:
    277
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You missed the first closing comment token in your sample code so that whole thing will be ignored.

    But, you're correct: it's completely unnecessary in an external file.
     
    penagate, Oct 13, 2006 IP
    AdamSee likes this.