html基本语法与语义写法规则详解

2020-07-10 14:16:27易采站长站整理

noydir 不使用 Yahoo Directory 来创建内容描述。

noarchive 不允许搜索引擎显示内容的缓存版本。

cache 允许搜索引擎显示内容的缓存版本。

nocache 不允许搜索引擎显示内容的缓存版本。

标签

定义文档的结构,使文档的标记更加语义化。

51383135e7679513f4e5e0746f2c367.png

tips

html5标签更加丰富和完善,div标签似乎没有什么用武之地,但是如果仅仅想在文档中加入一段样式,这个时候div标签便派上用场了。

标签在不同浏览器默认样式会有一些区别,为了一个网页在不同浏览器中看到的效果一样,通常要先格式化一下标签的样式

@charset "utf-8";html{margin:0;padding:0;border:0}a,abbr,acronym,address,article,aside,blockquote,body,caption,code,dd,del,dfn,dialog,div,dl,dt,em,fieldset,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,iframe,img,label,legend,li,nav,object,ol,p,pre,q,section,span,table,tbody,td,tfoot,th,thead,tr,ul{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,dialog,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1.5;background:#fff}table{border-collapse:separate;border-spacing:0}caption,td,th{text-align:left;font-weight:400;float:none!important}table,td,th{vertical-align:middle}blockquote:after,blockquote:before,q:after,q:before{content:''}blockquote,q{quotes:"" ""}a img{border:none}a{text-decoration:none}:focus{outline:0}

如果要在不支持html5的浏览器中使用html5标签,需要加一小段JavaScript代码

358da2d34591afb458b83f97d19b079.png

标签可编辑属性contenteditable

<article contenteditable></article>

更多编程相关内容,请关注php中文网编程入门栏目!