Solved

PRE tag width not working with IE PLEASE HELP

Posted on 2006-06-29
6
717 Views
Last Modified: 2013-11-19
I have a whole lot of text insdie  <pre width=80> ...</pre>

The problem is that IE, go figure, does not recognize the width setting.

Please help PLEASE!!
0
Comment
Question by:rpong
6 Comments
 
LVL 30

Accepted Solution

by:
callrs earned 500 total points
Comment Utility
Works in FF. Hmm.

www.scit.wlv.ac.uk/encyc/pre.html      The pre tag
"Also within <pre> ... </pre> long lines are no longer wrapped, they simple disappear out of the right hand side of the browser window although the browser horizontal scroll bar will usually reveal the text. "

http://www.w3schools.com/tags/tag_pre.asp     HTML PRE TAG
"The "width" attribute of the pre element was deprecated in HTML 4.01.
The "width" attribute of the pre element is not supported in XHTML 1.0 Strict DTD."

0
 
LVL 30

Expert Comment

by:callrs
Comment Utility
www.pcguide.com/vb/archive/index.php/t-22168.html
http://www.iconico.com/webtool/info.aspx?id=WrapPreText     Iconico - WebTools Pro
"Have you ever had to deal with continually scrolling left and right on a page? I've gotten so frustrated with the horizontal scrolling on newsgroup sites like http://groups.google.com, that I created this tool. The Wrap <Pre> Text function finds all preformatted text on a page, that is, text inside <Pre> tags, and makes sure that each line breaks at the edge of the window. You can now happily resize your window and just scroll vertically to read the newsgroups."
0
 
LVL 21

Expert Comment

by:Julian Matz
Comment Utility
The deprecated width attribute of the <pre> tag tells the browser the expected line length of the preformatted block so that a suitable font size or margin can be used, however, in practice, browsers ignore this attribute.

The <pre> tag displays preformatted text, so it actually wouldn't make much sense to have a width attribute, in my opinion... Have you tried using css instead of the width attribute?

<pre style="width:300px;">your text...</pre>

I don't know if it will work, but it's worth a try...

You could also try using a <div> tag instead. I don't know why you need to use the <pre> tag, but if it's for monospace font lettering, you could also try the following:

<div style="font-family:monospace;width:300px;">Your text...</div>
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Expert Comment

by:pritaeas
Comment Utility
You can use the Smarty template system to do this for you. You can set the line-length/wrapping the way you please. It will take care of displaying your text correctly.
0
 
LVL 10

Expert Comment

by:Havin_it
Comment Utility
If it's for a code listing, you might also consider the <code> tag (browsers should format this as monospace).
0
 

Author Comment

by:rpong
Comment Utility
I was using the PRE tag to retain the spaced, returns, and tabs in the text.
I found that the PRE tag in IE doesn't know when to return except when the text says to. It'll keep running of the page.

I eventually just said F it and used the <textarea> tag and set the rows and collumns to the same dimmensions as the PRE tag.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now