faqts : Computers : Internet : Web : HTML

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 9 people (78%) answered Yes
Recently 3 of 5 people (60%) answered Yes

Entry

When I copy and paste an article in the textarea box and sumit, the article's spacing is different. How do I prevent this from happening?

Mar 28th, 2003 02:44
Sergio Beristain, vorak seng, http://www.w3.org/TR/html4/struct/text.html#h-9.3.4


When you copy paste an article into a text area it is possible that you 
are submitting only the text and not the HTML.
So let's say that you are submitting "Here     I     am". The 
file "<HTML>Here    I    am</HTML>" will be read as "Here I am".
The reason being that HTML does not format spaces.
So there are two ways to do this this:
1.- you can use the <pre> tag which allows you render the text exactly 
as it is seen in the source:
"<HTML><pre>Here    I    am</pre></HTML>" to be seen as "Here    I    
am"
2.- The other option is to use a forced space entity " " :
So if you 
have "<HTML>Here   I   am</HTML>" will be 
read as "Here   I   am".
Disclamer: This will work on the assumption that the service in where 
you are submitting your article/text does not strip tags (<pre>) or 
converts special simbols ( ) into html entities.