SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello

    doing a sort of news window where i am dynamically reading the text into a layer and was wondering was there any way to keep a layer at its predefined width so that text will automatically break the line when it comes to the right edge of the layer?

    any help appreciated!

    Garrett

  2. #2
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    width: 300px maybe?

  3. #3
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes that sets the width of the layer but text within the layer does'nt break the line! instead it carries on off right of the layer.

    Garrett

  4. #4
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    overflow: auto should work.

  5. #5
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nope that gives scrollbars and still does'nt break the line.

    Garrett

  6. #6
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    phffft

  7. #7
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and i dont think 'phffft' is a valid css tag!

    Garrett

  8. #8
    SitePoint Guru sowen's Avatar
    Join Date
    Feb 2001
    Location
    Stockport, UK
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Set a class for your <p> tag width: 280px. Lines should wrap then

  9. #9
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not quite sure what you mean?

    <p style="width: 280px;"></p>

    a style like this?


    Garrett

  10. #10
    SitePoint Guru sowen's Avatar
    Join Date
    Feb 2001
    Location
    Stockport, UK
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but you could define it first to cut down on code.

    <style type="text/css">
    p {width: 280px}
    </style>

    Would give every paragraph a width of 240px.

    Or
    <style type="text/css">
    p.narrow {width: 280px}
    </style>

    then in your text;

    <p class="narrow">Some text that will wrap round when it gets to 240pixels</P>

    Only <p> tags with a class of narrow will be affected all others will act as normal.

    Hope this helps

  11. #11
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <html>
    <head>
    <title>test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <style type="text/css">
    p {width: 100px;
    font-size: 9px;
    }
    </style>

    </head>

    <body bgcolor="#FFFFFF">
    <p>
    dfjkdlfjkdjfkjdkfkdfjkldjfkdjfkdkfjkldjfkjdklfjkdfjkdjfkdjfkdjfkjdfkljdkfjkldfjkdjfkdjfkjdfkl
    </p>
    </body>
    </html>


    ------------------------------
    my code! the width does'nt seem to do anything? i know the style sheet works fine cos i stuck in the font-size and no problem!

    Garrett

  12. #12
    SitePoint Guru sowen's Avatar
    Join Date
    Feb 2001
    Location
    Stockport, UK
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Garret,

    you just need some spaces in the line of text. The browser thinks all those djfk's are one word so won't wrap them.

    Here is an exmple of the class thing

    <html>
    <head>
    <title>test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <style type="text/css">

    p {width: 75%;
    font-size: 9px;
    }

    p.narrow {width: 200px;
    font-size: 1em
    }

    p.narrower {width: 100px;
    font-size: 1em
    }
    </style>

    </head>

    <body bgcolor="#FFFFFF">
    <p>The quick brown fox jumped over lazey dog. Mary had a little lamb. The quick brown fox jumped over lazey dog. Mary had a little lamb.The quick brown fox jumped over lazey dog. Mary had a little lamb.The quick brown fox jumped over lazey dog. Mary had a little lamb.
    </p>
    <p class="narrow">The quick brown fox jumped over lazey dog. Mary had a little lamb. The quick brown fox jumped over lazey dog. Mary had a little lamb.The quick brown fox jumped over lazey dog. Mary had a little lamb.The quick brown fox jumped over lazey dog. Mary had a little lamb.</p>
    <p class="narrower">The quick brown fox jumped over lazey dog. Mary had a little lamb. The quick brown fox jumped over lazey dog. Mary had a little lamb.The quick brown fox jumped over lazey dog. Mary had a little lamb.The quick brown fox jumped over lazey dog. Mary had a little lamb.</p>
    </body>
    </html>

  13. #13
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    doh! ok sorry for being so silly!

    heres what i've been doing
    http://www.intimacyandloneliness.f2s...nts/index.php3

    thanks for your help
    Garrett

  14. #14
    SitePoint Guru sowen's Avatar
    Join Date
    Feb 2001
    Location
    Stockport, UK
    Posts
    729
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Site looks good, heavy subject! Good luck with the research.

    Need anymore help just ask

  15. #15
    SitePoint Addict Garrett's Avatar
    Join Date
    Feb 2001
    Location
    England
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks you've been very helpfull!

    Garrett


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
  •