Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Preserve White-space in <td>

    Hello PPL,

    So i have a table , which shows list of files in a given folder.

    Suppose a file contains multiple white-spaces e.x.
    a b.txt
    a SPACE SPACE b.txt (i think even here the whitespace is getting trimmed)
    inside a <td> of a table with NO styling or class applied, the white-space is getting trimmed into a sinlge space.

    I tried <td style="white-space: pre"> but that is not working.

    PRE tag works but only in ie8. not in firefox or safari.

    Pls help.

    thanks,
    smallcoder

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    You have several possibilities. Let's take two of them:

    1. use non-breaking space entity: &nbsp; for every white space. Not a recommended practice, but you may use it for 2-3 withe spaces, on need.

    2. nest some substring within SPAN elements and use the CSS padding:
    Code:
    <td>a<span style="padding-left:10px">b</span></td>
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is it the default behavior of all browsers to ignore the white-spaces.? I cannot replace the white-space with &nbsp; since the file name is retrieved on the fly from the database. So i needed some CSS or html solutions to preserve the white-space appearing in the file names.

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Then make some changes at the server-side level.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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