内联元素
yuhuo2022-04-01HtmlHtml
a
<a href="https://www.baidu.com" target="_blank">链接</a>
img
<img src="https://yuhuo520.gitee.io/vuepress/img/favicon.jpg" alt="图片" usemap="#myMap">
<!-- 根据屏幕像素密度决定图片路径 -->
<img srcset="foo-320w.jpg,
foo-480w.jpg 1.5x,
foo-640w.jpg 2x"
src="foo-640w.jpg">
<!-- 根据屏幕宽度决定图片宽度,根据图片宽度决定图片路径 -->
<img
srcset="example-320w.jpg 320w,
example-480w.jpg 480w,
example-800w.jpg 800w"
sizes="(max-width: 320px) 280px,
(max-width: 480px) 440px,
800px"
src="example-800w.jpg"
/>
map
<map name="myMap">
<area shape="rect" coords="10,10,40,40" href="https://www.baidu.com" target ="_blank" />
</map>
<img src="./demo.jpg" usemap="#myMap"/>
<map name="myMap">
<!-- 矩形区域,coords="x1, y1, x2, y2",即对角坐标 -->
<area shape="rect" coords="100,100,200,200" href="./1.html"/>
<!-- 圆形区域,coords="x, y, r",即圆心坐标和半径 -->
<area shape="circle" coords="150,150,50" href="./2.html"/>
<!-- 多边形区域,coords="x1, y1, x2, y2, x3, y3",即每个顶点坐标 -->
<area shape="poly" coords="100,100,200,200,100,200" href="./3.html"/>
<map>
label
<label for="myInput">标签</label>
input
<input type="text" placeholder="输入框" id="myInput" list="fruitList"/>
textarea
<textarea>文本域</textarea>
select
<select>
<option>米饭</option>
<option>零食</option>
<optgroup label="水果" disabled>
<option>苹果</option>
<option>香蕉</option>
</optgroup>
<optgroup label="蔬菜">
<option>菠菜</option>
<option>白菜</option>
</optgroup>
</select>
button
<button>按钮</button>
iframe
<iframe src="https://www.runoob.com"></iframe>
video
<!-- 一种播放格式 -->
<video src="https://tinify.com/static/videos/tinifycdn.mp4" width="400px" controls>
<!-- 指定字幕 -->
<track label="中文" kind="subtitles" src="subtitles_cn.vtt" srclang="cn" default>
<track label="英文" kind="captions" src="subtitles_en.vtt" srclang="en">
</video>
<!-- 多种播放格式(浏览器遇到支持的格式,就会忽略后面的格式) -->
<video>
<source src="https://tinify.com/static/videos/tinifycdn.mp4">
<source src="https://tinify.com/static/videos/tinifycdn.mov">
</video>
audio
<!-- 一种播放格式 -->
<audio src="https://yuhuo520.gitee.io/practice/static/audio/ringing.mp3"></audio>
<!-- 多种播放格式(浏览器遇到支持的格式,就会忽略后面的格式) -->
<audio>
<source src="https://yuhuo520.gitee.io/practice/static/audio/ringing.mp3">
<source src="https://yuhuo520.gitee.io/practice/static/audio/ringing.ogg">
</audio>
object
<object width="100" data="https://yuhuo520.gitee.io/practice/static/svg/firefox.svg">
<param name="参数名" value="参数值">
</object>
embed
<embed width="100" src="https://yuhuo520.gitee.io/practice/static/svg/firefox.svg" />