Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Preventing line breaks

    How can I prevent text from line breaking? In the example below, I want the phrase after the word PNGOut, not to be moved to the next line (please see screenshot: )

    Here is the code for that line:
    <a href=' http://brh.numbera.com/software/pnggauntlet/'>PNGGauntlet</a><div class = 'txt'>thorougly compresses PNGs (more compressed than usual image viewer/editing programs), a frontend for</div><a href='http://www.advsys.net/ken/utils.htm'>PNGOut</a><div class = 'txt'>, a utility that optimizes the size of .PNG files without losing any information. With the right options, it can often beat other programs by 5-10% (including PNGCRUSH -brute). PNGOUT is a great tool for optimizing the size of web pages.</div><br/>

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Change the <div> tags to <span> tags. The text should line break as normal.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Div markup

    You marked up the text outside the two links with divs: both inappropriate and unnecessary, and since divs are block level elements by default they flow underneath any previous content.

    In this case, if you want to have the two links flow with the rest of the text, simply mark up the entire section with a p (no divs) and style the two links as before.
    If you want the second link to start at a new line, a br could be used to terminate the previous line.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #4
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post

    Arbitrator, the <span> tags worked. Thanks. I am quite new to HTML and CSS, so my webpages are a bit problematic..

    ronaldb66, thanks for the suggestion. If I understand correctly, are you suggesting that I put the entire code I previously posted inside a <p> tag? I want to style the text outside of the links using CSS without affecting the links themselves (those inside <a>), that's why I put the div tags. Can you suggest a sample code for this?

  • #5
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,300
    Thanks
    28
    Thanked 275 Times in 269 Posts
    Sure thing. And yes, he meant to use the paragraph tags on the whole paragraph. Your links can be styled independent of the normal text.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Styling

    Your links can be styled independent of the normal text.
    Exactly: approach the other text in the p as "normal" text, and address the links' styling using the a element selector.

    I know the spans "work", but they're extra markup and are not necessary.
    Also, by using a p element to mark up what is essentially a paragraph of text (semantic markup), you get the default top and bottom margins--which you seem to try and emulate using extra br elements--on the p for "free".
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #7
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I see. Thanks.


  •  

    Posting Permissions

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