今天我们整理的是前端面试题—HTML5篇
1、HTML5有哪些新特性?移除了哪些元素?
HTML5的新特性如下:
(1) 拖放( Drag and drop)APIl
(2) 语义化更好的内容标签( header、nav、 footer、 aside、 article、 section)
(3) 音频、视频( audio、 video)API
(4) 画布( Canvas)API
(5) 地理( Geolocation)APl
(6) 表单控件包括 calendar、date、time、 email、url、 search。
移除的元素如下:
(1) 纯表现的元素,包括 basefont,big、 center、font、s, strike,t、u
(2) 对可用性产生负面影响的元素,包括 frame、 frameset、 Noframes
2.如何在HTML5页面中嵌入音频?
HTML5包含了嵌入音频文件的标准方式,支持的格式包括MP3、Wav和Ogg等,嵌入方式如下。
<audio controls>
<source src="icketang.mp3" type="audio/mpeg">
Your browser does'nt support audio embedding feature.
</audio>
3.如何在HTML5页面中嵌入视频?
当前,video 元素支持三种视频格式:
<video width="320" height="240" controls="controls">
<source src="movie.ogg" type="video/ogg">
<source src="movie.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
4.HTML5 canvas 元素有什么作用?
用于在网页上绘制图形,该元素标签强大之处在于可以直接在 HTML5 上进行图形操作
代码如下:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document<