-
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?
-
use span instead.
Code:
<p>One,<span style="width: 286; height: 57">Two,</span> Three</p>
-
nope it has to be a <div> - using asp.net so it comes down to other coding reasons.
-
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?
-
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.