SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 27

Thread: The <pre> tag

  1. #1
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    The <pre> tag

    Is the <PRE> tag still supported in XHTML 1.1 Strict?

    Thanks

    -Sam
    Sam Hastings

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think so... but I'd just use the following CSS code:

    Code:
    whitespace: pre;

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!

    -Sam
    Sam Hastings

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Welcome.

  5. #5
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it's actually
    Code:
    white-space: pre
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  6. #6
    SitePoint Wizard
    Join Date
    Mar 2002
    Location
    Bristol, UK
    Posts
    2,240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks to you too!

    -Sam
    Sam Hastings

  7. #7
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah... thanks for spotting that, Jeff.

    Sorry, Sam, for not catching that.

  8. #8
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Devilware.net
    Is the <PRE> tag still supported in XHTML 1.1 Strict?
    <PRE> isn't in any version of XHTML

    Try this:

    http://www.w3.org/TR/xhtml11/doctype.html#s_doctype

    Text Module*
    abbr, acronym, address, blockquote, br, cite, code, dfn, div, em, h1, h2, h3, h4, h5, h6, kbd, p, pre, q, samp, span, strong, var
    Also just for fun, XHTML 1.1 Strict does not exist either, it is just XHTML 1.1, because there are no other versions!

    Silly me,
    Douglas
    Hello World

  9. #9
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, well... some of us have to make mistakes.

  10. #10
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by compuwhiz7
    Ah, well... some of us have to make mistakes.
    Got to make up for those who don't

    Douglas
    Hello World

  11. #11
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My sentiments exactly.

  12. #12
    This is all Mumbo Jumbo Amit's Avatar
    Join Date
    Oct 2001
    Location
    New Delhi, India
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think this doesn't work in IE ?
    Any work arounds ?

  13. #13
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I could look it up .. but what does the "<pre>" tag used for anyways..
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  14. #14
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Amit
    I think this doesn't work in IE ?
    Any work arounds ?
    It works in IE6, the only work around in previous versions is to use the <pre> tag.

    (Chuckie: It makes code preserve white-space - enter, tab, space; useful for displaying plain text or code.)
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  15. #15
    This is all Mumbo Jumbo Amit's Avatar
    Join Date
    Oct 2001
    Location
    New Delhi, India
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Jeff, I tried it, it doesn't work in IE6 with XHTML 1 Transitional.
    I mean the tage <pre> works in HTML 4 and even in XHTML 1, (albeit it shouldn't in XHTML 1 Transitional) but
    div.pre
    {
    white-space: pre;
    }

    doesn't work

    Any help ?

  16. #16
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tested in IE 6:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD 
    XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    [...]
    
    p { white-space: pre; }
    
    [...]
    
    <p>This is some                  text</p>
    Douglas

    PS: What do you mean about pre not working in XHTML 1 Transitional? It is valid in Strict!
    Hello World

  17. #17
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Note that when using white-space:pre, it doesn't set any font settings, you'd need to define a font if you don't want the default one used.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  18. #18
    SitePoint Wizard bronze trophy
    Join Date
    Apr 2003
    Posts
    4,095
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right.

  19. #19
    SitePoint Wizard
    Join Date
    Nov 2000
    Location
    Chico, Ca
    Posts
    1,125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Jeff Lange
    (Chuckie: It makes code preserve white-space - enter, tab, space; useful for displaying plain text or code.)
    Thanks
    "Happiness doesn't find you, you find happiness" -- Unknown
    www.chuckknows.com

  20. #20
    This is all Mumbo Jumbo Amit's Avatar
    Join Date
    Oct 2001
    Location
    New Delhi, India
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Funny in IE

    Ok, here is the funny thing:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head>
    	<title>Just Tesing</title>
    <style>
    p { white-space: pre; }
    </style>
    </head>
    <body>
    <p>This is some				  text
    and then some
    then again ....</p>
    </body>
    works like charm in IE, but wait untill you add the xml prolog
    Code:
    <?xml verison='1.0' encoding='utf-8' ?>
    and it goes haywire ...
    Suggestions ?

  21. #21
    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)
    IE doesn't like the prolog and switches to horrible quirks mode....leave it out of your documents and you'll be fine
    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

  22. #22
    This is all Mumbo Jumbo Amit's Avatar
    Join Date
    Oct 2001
    Location
    New Delhi, India
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A quicke: But removing the prolog make non compliant to W3C standards ?

  23. #23
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's optional
    Hello World

  24. #24
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    XML Declaration: Not required with XHTML.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  25. #25
    SitePoint Zealot basicwebus's Avatar
    Join Date
    Jul 2003
    Location
    Missouri
    Posts
    127
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is a place at W3C where you can go to check out the <pre> tag: http://www.w3schools.com/tags/tag_pre.asp
    After the third time of reading the instructions,
    it finally soaks in to my thick skull.




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
  •