Forum Moderators: not2easy

Message Too Old, No Replies

<pre>venting my layout from working

         

createErrorMsg

8:43 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Help!

I am trying to use the <pre> tag to put some formatted code into a web page. It does this, yes, but the tag is utterly destroying my layout. WIthout the <pre> tag, the code is a mess but the layout is fine. As soon as I put in the <pre> tags, my content area expands to fill the screen (width-wise), my sidebar disappears down the page, it's a disaster.

Any idea why <pre> might mess up my layout?
Any idea what I can do about it?

pageoneresults

8:47 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



With the
<pre></pre>
element, you need to force line breaks or it will run on one line across the screen. Would that be the issue?

Wrapdida

8:52 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



maybe setting up CSS declarations on your <pre> tag like width:****% would do the trick.

createErrorMsg

10:07 pm on Jun 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just tried assigning a width to the pre element. Good idea but it didn't work. Even tried changing the display between inline and block (with a width value) but nothing changed.

I thought it WAS because <pre> retaines line breaks, but it's not the <pre> tag content that's stretching everything. It's actually a normal <p> element that is defining the end width.

What about options for wrapping? Any idea what's available in the specs for that?

Wrapdida

11:10 pm on Jun 24, 2004 (gmt 0)

10+ Year Member



what am weary about is it inhereting previous tag properties. we can pick it off one by one if you post your css for whatever container it is in.

Purple Martin

7:06 am on Jun 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The specs say that <pre> is an inline element, so width won't work unless you give it display:block;
[w3.org...]