HTML span标签学习笔记
生活随笔
收集整理的這篇文章主要介紹了
HTML span标签学习笔记
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
網址:
https://www.w3schools.com/tags/tag_span.asp
行內元素
span是inline(行內)元素。
設置寬高無效:
設置padding有效:
一小格是5px,兩小格是10px.
- padding設置上下左右都有效,即會撐大空間;
- 行內元素尺寸 由內含的內容決定
塊元素
例子是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的原創文章,盡在:“汪子熙”:
總結
以上是生活随笔為你收集整理的HTML span标签学习笔记的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 5月新规来了!官方出手整治互联网弹出广告
- 下一篇: 全球 4 月浏览器大战:Chrome 份