Help with DIV - how to eliminate carriage return

M

michaaal

When I use this code...

<div style="background-color:yellow;color:red;">Order Today</div> and
receive 10% off!

The "and receive..." starts at the next line. How can I prevent this from
starting at the next line? I would like for it to be a continuous line but
only have "Order Today" in red with the yellow background.
 
J

Jeff Thies

michaaal said:
When I use this code...

<div style="background-color:yellow;color:red;">Order Today</div> and
receive 10% off!

The "and receive..." starts at the next line. How can I prevent this from
starting at the next line? I would like for it to be a continuous line but
only have "Order Today" in red with the yellow background.

use span instaed of a div.

You can also add display: inline , but what you really have is a span,
so make it a span.

Jeff
 
J

Jukka K. Korpela

Jeff Thies said:
- -
use span instaed of a div.

You can also add display: inline , but what you really have is a
span, so make it a span.

To me, it looks very much like strong emphasis, so <strong> would be the
adequate markup. Besides, it would result in highlighted presentation
even on browsers that do not support CSS, or have CSS support disabled.

<span> says 'hi, I'm an inline text container, and my author found no
adequate semantic (or even physical) markup for my content, so I was
called to duty, to carry some attribute(s)'.
 
T

Toby Inkster

michaaal said:
<div style="background-color:yellow;color:red;">Order Today</div> and
receive 10% off!

<p><strong style="background-color:yellow;color:red;font-weight:normal;">
Order Today</strong> and receive 10% off!</p>
 

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,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top