Results 1 to 5 of 5

Thread: On line <div>

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183

    On line <div>

    Anyone know how to stop a div from moving to the next line?

    I want the following:

    "One, Two, Three"


    But all I can get is:

    "One,
    Two,
    Three"

    here is the code I have been using.

    <p>One,<DIV style="width: 286; height: 57">Two,</DIV> Three</p>

    Anyone know how to keep the div, but make this all appear on one line?

  2. #2
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    use span instead.
    Code:
    <p>One,<span style="width: 286; height: 57">Two,</span> Three</p>
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183
    nope it has to be a <div> - using asp.net so it comes down to other coding reasons.

  4. #4
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    then unless you position absolute them I don't think it will be possible cos div wants to be on its own line. I'm unfamilliar w/asp.net but what is the reasoning behind the div... maybe there is another way?
    I'm off to GalahTech, hope to see you there.

    If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.

  5. #5
    Fanatic Member riis's Avatar
    Join Date
    Nov 2001
    Posts
    551
    Div is a block-level element, where as span is an inline element.
    So, the default behaviour of a div-element is that it wraps to the next line, but a span element doesn't. I agree with msimmons on that.

    It might be possible to change this feature with, although I don't recommend it, but I'll mention it nevertheless.
    Add a style-attribute in the div tag with the following value: display: inline. This should cause the div tag to stay on the same line.

Posting Permissions

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



Click Here to Expand Forum to Full Width