I'm constantly modifying some text on a web page with JavaScript. I want the
text to be in-line with other elements, like texts, inputs, etc. What HTML element should I use? Both <di开发者_高级运维v>
and <p>
create new-lines and other things. <b>
kind of does what I want, but it bolds all the text. What's the correct alternative?
The <span>
tag is the in-line equivalent of <div>
.
<span>
you could also apply a display:inline style to a <div>
and get similar results
You can apply a float
, inline
or inline-block
to elements to get them to show up next to other elements. You can also use span
.
Use the font-weight
CSS property to make the <b>
element not bold and to keep everything inline:
.format {
font-weight: normal;
}
<b class="format">I am some text</b>
精彩评论