Removing break from DIV

R

Robert Mark Bram

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
:)
 
E

Eric Bohlman

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.
 
B

Beauregard T. Shagnasty

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?
 
S

Sid Ismail

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

: 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
 
R

Robert Mark Bram

How can I make it so that a div element won't break to a new line?
Use span classes instead; <span> was meant for exactly that sort of thing.

Thanks Eric - this is just what I wanted!

Rob
:)
 
R

Robert Mark Bram

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
:)
 
B

Beauregard T. Shagnasty

Robert Mark Bram pounced upon this pigeonhole and pronounced:
Hi BTS!


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>
 
D

Daniel R. Tobias

Robert said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top