Format sql text to html text.. Please help me...

Discussion in 'Databases' started by RahulSaini, Oct 18, 2012.

  1. #1
    Hello friends, i just create a comment form but here is some problem in this..
    First is when user post a comment then its display in single line....
    Second is After adding <pre> tag its going on a single line and increase page width too..
    Like as
    i have a Page with width 1000 pixel.
    two side bars one is 300px width and second is 160px..
    Now Site Body is left 600 or something..
    Normal Looks Like This..
    | | | |
    | | | |
    | | | |
    | | | |

    After Adding long Comment with <pre> tag, its format changed
    | | | |
    | | | |
    | | this is comment with long text no line breaks | |
    | | | |

    <----Page and body Width Increased.. Greater then 1000------->



    I want its automaticly breaks when its reach end of body table
    Like this
    | | | |
    | |this is a | |
    | |comment | |
    | |with long | |
    | |text no | |
    | |Line | |
    | |breaks | |


    Any suggetions will be helpful...
    Thanks!!
     
    RahulSaini, Oct 18, 2012 IP
  2. jadexe

    jadexe Member

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    26
    #2
    Add this to your css:
    
    pre {     
    white-space: -moz-pre-wrap; /* Mozilla, supported since 1999 */     
    white-space: -pre-wrap; /* Opera */
         white-space: -o-pre-wrap; /* Opera */     
    white-space: pre-wrap; /* CSS3 - Text module (Candidate Recommendation) [URL]http://www.w3.org/TR/css3-text/#white-space[/URL] */ 
        word-wrap: break-word; /* IE 5.5+ */ }
    
    Code (markup):
    Source: http://stackoverflow.com/questions/1634203/pre-tag-in-html-with-fixed-width
     
    jadexe, Oct 26, 2012 IP
  3. RahulSaini

    RahulSaini Well-Known Member

    Messages:
    222
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    123
    #3
    Thanks...!
     
    RahulSaini, Nov 3, 2012 IP