有关html

有关HTML

W3C简介

万维网联盟(W3C)是万维网(缩写为WWW或W3)的主要国际标准组织。

该组织由Tim Berners-Lee创立并目前领导,由成员组织组成,这些组织维持全职员工,共同制定万维网标准。

MDN简介

MDN(Mozilla Developer Network),即 Mozilla开发人员网络,是面向开发人员的资源,由开发人员和技术作家社区维护,并在各种主题上托管许多文档,例如:HTML5,JavaScript,CSS,Web API,Node.js,WebExtensions和MathML。

MDN Web Docs是一个不断发展的Web技术学习平台和支持Web的软件,包括:
Web标准,如CSS,HTML和JavaScript;
打开Web应用程序开发;
Firefox附加开发.

HTML所有标签

reference:https://developer.mozilla.org/en-US/docs/Web/HTML/Element

Main root:

<html>

Document metadata:

<base>,<head>,<link>,<meta>,<style>,<title>

Sectioning rootEdit:

<body>

Content sectioning:

<address>,<article>,<aside>,<footer>,<header>,<h1>, <h2>, <h3>, <h4>, <h5>, <h6>,<hgroup>,<main>,<nav>,<section>

Text content:

<blockquote>,<dd>,<dt>,<dl>,<div>,<figcaption>,<figure>,<hr>,<li>,<main>,<ol>,<p>,<pre>,<ul>

Inline text semantics:

<a>,<abbr>,<b>,<bdi>,<bdo>,<br>,<cite>,<code>,<data>,<dfn>,<em>,<i>,<kbd>,<mark><q>,<rb>,<rp>,<rt>,<rtc>,<ruby>,<s>,<samp>,<small>,<span>,<strong>,<sub>,<sup>,<time>,<tt>,<u>,<var>,<wbr>

Image and multimedia:

<area>(use only within <map>),<audio>,<img>,<map>,<track>,<video>

Embedded content:

<applet>,<embed>,<iframe>,<noembed>,<object>,<param>,<picture>,<source>

Scripting:

<canvas>,<noscript>,<script>

Demarcating edits:

<del>,<ins>

Table content:

<caption>,<col>,<colgroup>,<table>,<tbody>,<td>,<tfoot>,<th>,<thead>,<tr>

Forms:

<button>,<datalist>,<fieldset>,<form>,<input>,<label>,<legend>,<meter>,<optgroup>,<option>,<output>,<progress>,<select>,<textarea>

Interactive elements:

<details>,<dialog>,<menu>,<menuitem>,<summary>

Web Components:

<element>,<element>,<shadow>,<slot>,<template>

Obsolete and deprecated elementsEdit:

<acronym>,<applet>,<basefont>,<bgsound>,<big>,<blink>,<center>,<command>,<content>,<dir>,<element>,<font>,<frame>,<frameset>,<image>,<isindex>,<keygen>,<listing>,<marquee>,<menuitem>,<multicol>,<nextid>,<nobr>,<noembed>,<noframes>,<plaintext>,<shadow>,<spacer>,<strike>,<tt>,<xmp>

空标签/空元素

在html中,通常在一个空标签/空元素上使用闭标签是无用的,例如<input type="text"></input>的闭标签是无效的html。
html中有以下空标签:
<area>,<base>,<br>,<col>,<colgroup> when the span is present,<command>,<embed>,<hr>,<img>,<input>,<keygen>,<link>,<meta>,<param>,<source>,<track>
,<wbr>

可替换标签/可替换元素

在css中,可替换标签/元素的样式不由css控制,这些元素的外观渲染独立于css外,例如:<img>, <object>, <video>,<textarea>,<input>;某些元素只在一些特定情况下表现为可替换元素,例如: <audio>,<canvas>

HTML5,XHTML,H5

HTML5: A vocabulary and associated APIs for HTML and XHTML.兼容html和xhtml两种写法。xhtml基于xml语言,所有标签都需要闭合,例如<input/>。在html5中兼容两种写法,会自动将<input/>纠正成<input>。

H5:简单的来说,h5是能够在微信上运行的网页,和html5并无关系。

HTML5之容易忽视的问题

  • <title>是必须写的,如果缺省则不合法,但浏览器会自动补上;
  • 除了<div>,<span>其他标签/元素都有默认样式;
  • <b>和<strong>区别?前者是一种物理状态(表示字体应该被加强),后者是一种逻辑状态(表示该内容在逻辑上是重要的);
  • <noscript>在<head>中引用,表示用户禁用javascript或页面脚本不被支持,所现实的html section.
  • a标签的4种target属性值:_blank, _self, _parent, _top.
  • 如何实现下载?</br>
    1.<a>标签的download属性;
    2.http响应中第二部分为content-type:application/octet-stream
  • a标签的href属性:</br>
    <a href=""></a>跳转到自身页面,且页面滚动到底部;
    <a href="#"></a>页面根据锚点进行跳转,不发送任何请求;
    <a href="qq.com"></a>指向一个不存在的文件,因此不能打开任何页面;
    <a href="//qq.com"></a>无协议时,自动继承当前页面的协议。
    注意:file协议不支持post请求;
    <a href="?name=frank"></a>浏览器自动识别意思,并发起get操作。
    <a href="javascript:alert(1);"></a>javascript伪协议,用户在地址栏输入alert(1)会激发该命令;
    <a href="javascript:;"></a>点击a标签,但不发生任何操作;
  • html中只有<form>标签可以提交post请求。