开发者

HTML element that contains no formatting

开发者 https://www.devze.com 2022-12-30 14:34 出处:网络
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开发者_高级运维

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>

0

精彩评论

暂无评论...
验证码 换一张
取 消