View Full Version : line break before pre tag, get rid of
chopficaro
03-15-2010, 10:17 PM
i want to make a block of text with scroll bars. so i used the pre tag. but all browsers automatically generate a line break before the pre tag of the same size as the font size inside the pre tag. for design reasons this is bad in my case. can i get rid of the line break? or is there another way to create a box of text with a scroll bar?
chopficaro
03-15-2010, 10:41 PM
hmmm well i just found out that i could use the div tag and set the overflow to scroll, but that gets rid of my formatting, i like how the div tag fits though. so how do i keep my formatting? maybe somehow i could import a word document in php or something?
simcomedia
03-15-2010, 11:02 PM
Assign the div a class name and style it:
.scrolldiv {
font-family: Georgia;
font-size: 10pt;
color: #999;
font-weight: 900;
border: 1px #000 dotted;
padding: 10px;
background-color: #ccc;
}
chopficaro
03-16-2010, 12:51 AM
ty! works great!
djr33
03-16-2010, 01:31 AM
The more in depth explanation is that tags are by default styled in a certain way. It's possible (to a great degree, if not entirely in some cases) to change the format of any tag by using CSS like above.
The basic idea, though, is that tags come with an underlying "CSS" style (if you want to think of it like that), so that, for example, a <p> tag does a certain thing with line breaks and a <h1> tag does a certain thing with font sizes-- but all of this can be changed by using CSS to restyle the tags (again, at least to a great degree).
So if you want to use <pre>, that may be the right approach, but just use CSS like above and fix it to perform correctly.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.