Removing break from DIV

Discussion in 'HTML' started by Robert Mark Bram, Oct 17, 2003.

  1. Howdy All!

    Currently, this:
    <div>one two </div><div>three</div>
    will produce this:
    one two
    three

    How can I make it so that a div element won't break to a new line?

    I would like to do this so I can build a system that uses div classes to
    represent bold, italics and so on...
    <div class="bold">one two </div><div class="italics">three</div>

    Thanks for any advice!

    Rob
    :)
    Robert Mark Bram, Oct 17, 2003
    #1
    1. Advertising

  2. Robert Mark Bram

    Eric Bohlman Guest

    "Robert Mark Bram" <> wrote in
    news:3f906b24$0$3699$:

    > Howdy All!
    >
    > Currently, this:
    > <div>one two </div><div>three</div>
    > will produce this:
    > one two
    > three
    >
    > How can I make it so that a div element won't break to a new line?
    >
    > I would like to do this so I can build a system that uses div classes to
    > represent bold, italics and so on...
    > <div class="bold">one two </div><div class="italics">three</div>


    Use span classes instead; <span> was meant for exactly that sort of thing.
    Eric Bohlman, Oct 17, 2003
    #2
    1. Advertising

  3. Robert Mark Bram pounced upon this pigeonhole and pronounced:
    > Howdy All!
    >
    > Currently, this:
    > <div>one two </div><div>three</div>
    > will produce this:
    > one two
    > three
    >
    > How can I make it so that a div element won't break to a new line?
    >
    > I would like to do this so I can build a system that uses div classes to
    > represent bold, italics and so on...
    > <div class="bold">one two </div><div class="italics">three</div>
    >
    > Thanks for any advice!


    <b>one two</b> <i>three</i> or better yet

    <strong>one two</strong> <em>three</em>

    If there is a real element for it, use it. Also, neither of these will
    cause a newline. A <div> is a block-level element and is expected to issue
    a newline, unless trickery is involved.

    You wouldn't say: <div>This is a paragraph.</div> would you?

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Oct 17, 2003
    #3
  4. Robert Mark Bram

    Sid Ismail Guest

    On Sat, 18 Oct 2003 08:20:35 +1000, "Robert Mark Bram"
    <> wrote:

    : Howdy All!
    :
    : Currently, this:
    : <div>one two </div><div>three</div>
    : will produce this:
    : one two
    : three
    :
    : How can I make it so that a div element won't break to a new line?
    :
    : I would like to do this so I can build a system that uses div classes to
    : represent bold, italics and so on...
    : <div class="bold">one two </div><div class="italics">three</div>


    use span :)

    Sid
    Sid Ismail, Oct 17, 2003
    #4
  5. > > How can I make it so that a div element won't break to a new line?
    > >
    > > I would like to do this so I can build a system that uses div classes to
    > > represent bold, italics and so on...
    > > <div class="bold">one two </div><div class="italics">three</div>

    >
    > Use span classes instead; <span> was meant for exactly that sort of thing.


    Thanks Eric - this is just what I wanted!

    Rob
    :)
    Robert Mark Bram, Oct 17, 2003
    #5
  6. Hi BTS!

    > <b>one two</b> <i>three</i> or better yet
    >
    > <strong>one two</strong> <em>three</em>


    I don't want to do this - I want to build a system where I can treat each
    section of text as being the same html element type (through ASP).

    The idea is that I am pulling sections of text (without html tags) from a
    database and putting them into spen elements (thanks to Eric's reply). I
    will then apply styling information through a combination of css and class
    attributes applied to the span element.

    Rob
    :)
    Robert Mark Bram, Oct 17, 2003
    #6
  7. Robert Mark Bram pounced upon this pigeonhole and pronounced:
    > Hi BTS!
    >
    > > <b>one two</b> <i>three</i> or better yet
    > >
    > > <strong>one two</strong> <em>three</em>

    >
    > I don't want to do this - I want to build a system where I can treat each
    > section of text as being the same html element type (through ASP).
    >
    > The idea is that I am pulling sections of text (without html tags) from a
    > database and putting them into spen elements (thanks to Eric's reply). I
    > will then apply styling information through a combination of css and class
    > attributes applied to the span element.


    Well, ok, if the particular styling you need is... unconventional, do so
    with <span>. Your sample, though, was for bold and italic. <g>

    --
    -bts
    -This space intentionally left blank.
    Beauregard T. Shagnasty, Oct 18, 2003
    #7
  8. Robert Mark Bram wrote:

    > I don't want to do this - I want to build a system where I can treat each
    > section of text as being the same html element type (through ASP).
    >
    > The idea is that I am pulling sections of text (without html tags) from a
    > database and putting them into spen elements (thanks to Eric's reply). I
    > will then apply styling information through a combination of css and class
    > attributes applied to the span element.


    That's not very good for logical structure. The DIV and SPAN elements
    are intended for marking things up when no specific tag exists for the
    particular element you want to indicate. You shouldn't use them when
    perfectly good HTML markup already exists for the purpose you're aiming
    to accomplish.

    --
    == Dan ==
    Dan's Mail Format Site: http://mailformat.dan.info/
    Dan's Web Tips: http://webtips.dan.info/
    Dan's Domain Site: http://domains.dan.info/
    Daniel R. Tobias, Oct 18, 2003
    #8
  9. Robert Mark Bram wrote:

    > The idea is that I am pulling sections of text (without html tags) from a
    > database and putting them into spen elements (thanks to Eric's reply). I
    > will then apply styling information through a combination of css and class
    > attributes applied to the span element.


    http://groups.google.com/groups?selm=

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
    Toby A Inkster, Oct 18, 2003
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris  Chiasson
    Replies:
    6
    Views:
    614
    Richard Tobin
    Nov 14, 2006
  2. Replies:
    12
    Views:
    957
  3. K Viltersten

    <div ... /> and <div ...></div>

    K Viltersten, Mar 30, 2009, in forum: ASP .Net
    Replies:
    4
    Views:
    743
  4. Dwayne Madsen

    Q: Div A inside Div B is larger than Div B

    Dwayne Madsen, Jun 1, 2005, in forum: Javascript
    Replies:
    1
    Views:
    185
    David Dorward
    Jun 1, 2005
  5. mscir
    Replies:
    3
    Views:
    307
    Martin Honnen
    Jun 26, 2005
Loading...

Share This Page