Front-end interview questions HTML

Front-end interview questions CSS: https://my.oschina.net/u/3674939/blog/1637877

Front-end interview questions JavaScript: https://my.oschina.net/u/3674939/blog/1640595

Other front-end interview questions (security, performance, loading, etc.): https://my.oschina.net/u/3674939/blog/1643029

What's changed in HTML5

  • New Semantic Elements
  • Form enhancements
  • new API

What is the meaning of semantic

  • Easy for developers to understand
  • Helps with SEO
  • Machines can easily understand the structure
  • semantic microdata

How to handle html5 new tag compatibility

Principle: IE8/IE7/IE6 supports tags generated by the document.createElement method

article,aside,dialog,footer,header,section,nav,figure,menu{display:block}

<!--[if lt IE 9]>
    <script src="http://cdn.static.runoob.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
<![endif]-->

The relationship between HTML and DOM

  • HTML is text markup and is dead
  • The DOM is parsed from HTML to generate a DOM tree, and JS can maintain the DOM

DOCTYPE understanding

Declare the doctype, telling the browser what doctype to use

possible meta tags

<!-- 设置缩放 -->
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
<!-- 可隐藏地址栏,仅针对IOS的Safari(注:IOS7.0版本以后,safari上已看不到效果) -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- 仅针对IOS的Safari顶端状态条的样式(可选default/black/black-translucent ) -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
<meta name="format-detection"content="telephone=no, email=no" />

其他meta标签
<!-- 启用360浏览器的极速模式(webkit) -->
<meta name="renderer" content="webkit">
<!-- 避免IE使用兼容模式 -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 -->
<meta name="HandheldFriendly" content="true">
<!-- 微软的老式浏览器 -->
<meta name="MobileOptimized" content="320">
<!-- uc强制竖屏 -->
<meta name="screen-orientation" content="portrait">
<!-- QQ强制竖屏 -->
<meta name="x5-orientation" content="portrait">
<!-- UC强制全屏 -->
<meta name="full-screen" content="yes">
<!-- QQ强制全屏 -->
<meta name="x5-fullscreen" content="true">
<!-- UC应用模式 -->
<meta name="browsermode" content="application">
<!-- QQ应用模式 -->
<meta name="x5-page-mode" content="app">
<!-- windows phone 点击无高光 -->
<meta name="msapplication-tap-highlight" content="no">

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325868811&siteId=291194637