网址:
https://www.w3schools.com/tags/tag_span.asp
span是inline(行内)元素。
设置宽高无效:
设置padding有效:
一小格是5px,两小格是10px.
例子是div
浅绿色的就是margin区域:
设置高度和宽度起作用。
一个典型的span用法:
<!DOCTYPE html>
<html>
<body>
<h1>The span element</h1>
<p>My mother has <span style="color:blue;font-weight:bold">blue</span> eyes and my father has <span style="color:darkolivegreen;font-weight:bold">dark green</span> eyes.</p>
</body>
</html>
The span tag is an inline container used to mark up a part of a text, or a part of a document.
The span tag is much like the div element, but div is a block-level element and span is an inline element.
和div作用类似,但span是inline元素,div是block元素。
何时应该使用span?
It should be used only when no other semantic element is appropriate.
更多Jerry的原创文章,尽在:“汪子熙”