Help - Search - Members - Calendar
Full Version: unwanted white space (extra lines) within <pre></pre>
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
allrounder
Title says it all!

I use the <pre></pre> tags to get the exact bare bones layout I want yet the info is appearing on screen with extra lines either side of the text.

I've examined the html and can see no reason why this would be occuring. Thoughts?

allrounder
here's a link to an example:

the detail of the scorecard is enclosed in the <pre></pre> tags...Scorecard

and here's one that does work (albeit a bit nicer looking!) - Scorecard
pandy
Come on now... You use PRE because you want to preserve whitespace, right? Yet you add blank lines in the source code. biggrin.gif

CODE
Batsman       How Out        Bowler            R    M    B   4  6  FOW

L Ebsary      c. Coleman     Farrell          18   30   24         2/41

P Merrilees   run out (K Blackwell)            1    1    2         1/2


"The PRE element contains preformatted text. Visual browsers should render preformatted text in a fixed-width font, should not collapse whitespace, and should not wrap long lines"
http://htmlhelp.com/reference/html40/block/pre.html

Whitespace is (mainly) spaces, tabs and carriage returns. happy.gif
allrounder
Hi Pandy

Thanks for replying but in my source code I DID not include blank lines - these appeared after the file was uploaded to the site.

I am well aware of what whitespace is but thanks for reminding me.
pandy
They are there in the source now anyhow. If you were aware of the problem, I don't understand your question. Especially since you say "I've examined the html and can see no reason why this would be occurring.".
allrounder
I can see they are there in the web version - but they are not there in my original code.

I want to know what is causing them to appear and how I can stop it.
pandy
I don't know. Have you tried uploading the file again?
allrounder
yes, several times
allrounder
I've even saved the version appearing online and opened that up only to see no blank lines??
pandy
I don't understand how that can happen since the blank lines are there in the source. How did you download it? View source?
allrounder
I've tried fixing it two ways.

View source which shows the line breaks as you've found - I saved that, deleted the blank lines and reloaded. Same result.

I also did "save target as" but no blank lines showed in that when opened!
Christian J
Some FTP programs may add extra newlines depending on the text editor used: http://en.wikipedia.org/wiki/Newline#Common_problems
allrounder
Thanks for that info.

I use either CoffeeCup's HTML editor or notepad to make quick changes - doesn't seem to matter which one I use.
pandy
I assumed the other, correct, document was produced and uploaded in the same way. Was it?

What about binary mode then? Can you have turned that on by mistake in your FTP client?
allrounder
The correct document was produced the same way.

I will check the FTP settings but I'm pretty sure it's done automatically...
pandy
Hej, upload another document with a few lines in it and see if it happens to that too.
allrounder
same thing happens...
allrounder
does it help if I say the extra blank lines are appearing between every line of code but only the ones between the <pre></pre> tags are affecting the webview (as you'd expect)??
pandy
I have no idea if something on the server can cause this. Seems far-fetched, but maybe it's possible.
Christian J
QUOTE(allrounder @ Oct 28 2009, 11:17 PM) *

does it help if I say the extra blank lines are appearing between every line of code

Sounds like the newline problem I linked to above.
pandy
Yeah, but alrounder has used the same gear for these files as he did earlier when he didn't get the double line breaks. So what else could have changed?
allrounder
and, more importantly, how do I fix it?!
pandy
We won't know that until we know what it is. tongue.gif

Maybe a little talk with your host would be in place.
allrounder
that's not possible, I'll have to solve it from my end
allrounder
I've successfully loaded the file as it should appear with Filezilla so it looks like it is an issue with both net2ftp and CoffeeCup's HTML Editor
pandy
How odd. I thought this problem was something of the past. I've never seen it myself actually. Good your problem is solved anyway and FileZilla is a great FTP client.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.