/    Sign up×
Community /Pin to ProfileBookmark

How to wrap formated contents in a cell?

Hi, there:

I’m a newbie, and I haven’t found the answer yet. ?

My question is:
I want to display contents retrieved from database (e.g. in a BBS) in a table cell that has fixed width. How can I “add newline characters” to lines that exceed the width, while preserving the format of the contents?

Thank you very much!

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@felgallApr 26.2006 — HTML will add the new lines for you as required.
Copy linkTweet thisAlerts:
@luckybirdauthorApr 27.2006 — Thank you, Stephen.

But, do I have to use JavaScript function to achieve that?
Copy linkTweet thisAlerts:
@felgallApr 27.2006 — No. Just have the server side processing that is retrieving the content from the database put it where you want it and the browser should take care of the rest.
Copy linkTweet thisAlerts:
@luckybirdauthorApr 27.2006 — Ok, as the tests turned out, that's the case when you don't set the fixed width of the table cell so that the cell can stretch itself to fix the content.

But when you set the fixed width of table cells, problems come:

  • 1. If you use <pre></pre> to preserve the context's format, long text lines can never be split to meet the width of the cell. Instead, they are truncated.


  • 2. If you do NOT use <pre></pre>, new line chars are added automatically to long text lines. However, you've lost the original format of the text (e.g. newline chars).


  • So, what should I do?
    Copy linkTweet thisAlerts:
    @luckybirdauthorApr 28.2006 — can someone help me?
    ×

    Success!

    Help @luckybird spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.19,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...