Results 1 to 5 of 5

Thread: line break before pre tag, get rid of

  1. #1
    Join Date
    Dec 2009
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default line break before pre tag, get rid of

    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?

  2. #2
    Join Date
    Dec 2009
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  3. #3
    Join Date
    Sep 2008
    Location
    Seattle, WA
    Posts
    135
    Thanks
    1
    Thanked 11 Times in 11 Posts

    Default

    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;
    }

  4. #4
    Join Date
    Dec 2009
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ty! works great!

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •