|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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>
|
|
#2
|
||||
|
||||
|
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:
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" |
![]() |
| Viewing: Dev Shed Forums > Web Design > CSS Help > Giving a width to a pre tag |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|