Making a <div> element without a newline before it?
Here's my code:
Your rating开发者_开发技巧: <div>4</div>
It looks like:
Your rating:
4
How can I make a div not make a newline before it?
<div style="display:inline-block">4</div>
or
<div style="display:inline">4</div>
It really depends on how you want to use the div container. It might even be more practical (for the latter example) to use a span if you do not want a block element.
Though you can use a <div> to do that, most people would recommend you use a <span> instead.
Make it a <span>4</span>
OR
Wrap it with natural HTML <em>
, <strong>
, and style that child accordingly.
#mypost strong {...}
http://css-tricks.com/css-beginner-mistakes-1/
You need to make your div display "inline" instead of the default "block". Take a look at this question.
DIV is block level element by default. You can add style='display:inline' to display in one line. or u can use Span or Label tag instead of DIV
you can use span
Your rating: <span>4</span
OP: Your rating: 4
精彩评论