CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 16th, 2004, 04:50 AM
BugMeNot BugMeNot is offline
Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 42 BugMeNot User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 52 m 39 sec
Reputation Power: 0
Giving a width to a pre tag

Hi there,

First of all, i posted this in the HTML section as well, but after some consideration i think it is a CSS needy question. However i can not remove my own post from the HTML section?

Problem explained:

I would like to give a maximum width to a text in a <pre> </pre> tag. Now by giving it a standard width or a width via a cascading style sheet class does not work.

I also tried wrapping it in a table and / or a div with the width attribute.

Anyone got an idea how to solve this?

Regards,

Sander Meilink

By the way, pre does what it is supposed to do, it remembers the linebreaks a.o. very well.

Example of all things tried combined:

Code:
<table cellspacing="2" cellpadding="2" border="0" width="20">
<tr>
    <td width="20"><div style="width: 20px;"><pre style="width: 20px;">asd fasod  khgfas kjdgfkjasg dfkjhsagd fjgas sadkjfg dsafkjhg sdfkhg jhg jkhgdsfjkhg jkhgsdfa</pre></div></td>
</tr>
</table>

Reply With Quote
  #2  
Old July 20th, 2004, 12:10 PM
grungefade's Avatar
grungefade grungefade is offline
I'm just an IF statement
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 400 grungefade User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 2 h 26 m 33 sec
Reputation Power: 5
thats impossible with a <pre> tag. The only way to do it is to get rid of the <pre> tag. The <pre> tag is for formatting... And you put it around things you want to control the look of exactly. so it will not follow outside rules to format the text.

the only way you can get text to drop down to a new line in a <pre> tag is either the <br> tag or hitting enter inside the code like this.

PHP Code:
<table cellspacing="2" cellpadding="2" border="0" width="20">
<
tr>
    <
td width="20"><div style="width: 20px;">
      <
pre style="width: 20px;">asd fasod
  khgfas kjdgfk
jasg dfkjhsagd 
fjgas sadkjfg ds
afkjhg sdfkhg j
hg jkhgdsfjkhg j
khgsdfa
</pre>
    </
div></td>
</
tr>
</
table


so the <pre> tag is very nice because it will look exactly like you make it look in the code without any tags. Spaces and returns.
__________________
"In a way, we're dead already"

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Giving a width to a pre tag


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT