Click to See Complete Forum and Search --> : How do I retain spaces in text
codingisfun
12-05-2007, 03:15 PM
I have a Item Description field which has length 25 and the database has the following record:
24" LINEN CLOTH................(WIDE) where ..... is blanks.
When I retrieve data to HTML the page displays:
24" LINEN CLOTH (WIDE) the blanks are chopped off.
How do I retain blanks in WebPage? Thanks.
DaveSW
12-05-2007, 03:45 PM
you could use a non-breaking space ;)
Or if it's essentially tabulated data you could use a table.
zoltankis
12-05-2007, 04:21 PM
I have a Item Description field which has length 25 and the database has the following record:
24" LINEN CLOTH................(WIDE) where ..... is blanks.
When I retrieve data to HTML the page displays:
24" LINEN CLOTH (WIDE) the blanks are chopped off.
How do I retain blanks in WebPage? Thanks.
<pre style="font-family: Courier New, Courier, monospace">
24" LINEN CLOTH................(WIDE)
</pre>
WebJoel
12-05-2007, 05:57 PM
Probably not as good as "<pre>", but :<p> 24" LINEN CLOTH <span style="margin-left:75px;">(WIDE)</span> </p>or the longer:<p style="width:238px;"><span style="float:left;">24" LINEN CLOTH</span><span style="float:right;">(WIDE)</span></p>and have control over the html document instead of being at the mercy of the copy.
I used "margin-left:75px" on a "span" in the first example.
In the second example, because "<p>" is a block-level element, you need to state a width to get the floats to function correctly (assuming we wanted the second example to resemble the first example), otherwise, the block-level "p" goes full-width of container or page.
I'm sure that there are a few ways to acheive this, and not sure how this would work with a database system. :confused:
thanix
12-06-2007, 01:45 AM
I used "margin-left:75px" on a "span" in the first example.
In the second example, because "<p>" is a block-level element, you need to state a width to get the floats to function correctly (assuming we wanted the second example to resemble the first example), otherwise, the block-level "p" goes full-width of container or page.
In this context, if you want to read more on how to make "floats" work or just what intricacies are involved with floats, you may want to check out my blog post on floats - http://thanix.info/blog/2007/12/05/the-making-of-a-webdev-3/