SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Inline styles and Strict doctype

    With a strict doctype, can I have something like this:
    Code:
    <p><span style="color: navy; text-decoration: underline"><b>some text</b></span></p>
    or do I have to do this:
    Code:
    <p><span class="myclass"><b>some text</b></span></p>
    ...and put the .myclass style declaration in a .css file?
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    With XHTML 1.0 Strict you can have inline styles. With XHTML 1.1 you have to have all of your styles either in the <head> of your document in a <style> tag, or in a separate CSS file. I don't recommend inline styles anyway, as it reduces the maintainability of your code. It's better to just slap an ID on the element you're using and style it somewhere else.

  3. #3
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you vgarcia. I was also wondering this:

    At http://www.alistapart.com/stories/doctype/ , I was learning about the different doc types and I noted that for XHTML1.1, there is no strict/transitional wording its respective doctype declaration.

    So is this considered strict?:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
    	   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."


  4. #4
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    xhtml1.1 is strict by definition, yes
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    If you do need inline styles, then by all means stick with XHTML 1.0 Strict. There really is no advantage in having an XHTML 1.1 doctype currently, except to say "My site is XHTML 1.1".

  6. #6
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by garlinto
    With a strict doctype, can I have something like this:
    Code:
    <p><span style="color: navy; text-decoration: underline"><b>some text</b></span></p>
    or do I have to do this:
    Code:
    <p><span class="myclass"><b>some text</b></span></p>
    ...and put the .myclass style declaration in a .css file?

    [FWIW]

    I guess the question was purely academic, so here's an academic addendum...

    Code:
    css:
    p.myclass {
    color: navy;
    text-decoration;
    font-style: bold;
    }
    
    ...
    
    markup:
    <p class="myclass">some text</p>
    Better, no?
    Just a thought.

    [/FWIW]
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  7. #7
    I want my 4th arrow! garlinto's Avatar
    Join Date
    Jun 2002
    Location
    Riding the electron wave
    Posts
    372
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks fellas. I was wondering this because I am currently using XHTML1.0 transitional and was kicking around coding for strict.

    I apologize if the question sounds academic, but since I am unfamiliar with strict, I guess I can't help it. I wanted to know how inline styles were viewed, since I use them in addition to my external style sheet. Thanks for the info.

    Incidently, I have since changed my doctype to strict, and only had 10 errors according to the W3C, so I guess I'm not as bad off as I thought.
    Ducharme's Axiom: "If you view your problem closely
    enough, you will recognize yourself as part of the problem."



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •