Html ways of using CSS style

HTML <! DOCTYPE> declaration tag

定义和用法
<!DOCTYPE> 声明必须是 HTML 文档的第一行,位于 <html> 标签之前。
<!DOCTYPE> 声明不是 HTML 标签;它是指示 web 浏览器关于页面使用哪个 HTML 版本进行编写的指令。
在 HTML 4.01 中,<!DOCTYPE> 声明引用 DTD,因为 HTML 4.01 基于 SGML。DTD 规定了标记语言的规则,这样浏览器才能正确地呈现内容。
HTML5 不基于 SGML,所以不需要引用 DTD。

各版本的声明
    HTML5      <!DOCTYPE html>  、  <meta charset="utf-8">
    HTML 4.01        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
    、该 DTD 包含所有 HTML 元素和属性,包括展示性的和弃用的元素(比如 font)。不允许框架集(Framesets)
    、<meta http-equiv=Content-Type content="text/html;charset=utf-8">
注意的规则  :  单标记必须闭合比如<br>必须写为<br />  <input />
                           单属性必须添加属性值    <input typr="radio" checked >必须写为<input typr="radio" checked="checked" />
                           标记和属性必须使用小写     <Body><BODY>是错的必须写为<body>
                           属性的属性值必须使用""    在HTML4.01之前可以使用<body bgcolor=red>,HTML4.01必须写为<body bgcolor="red">
                           
内链样式表      <body style="background-color:green; margin:0; padding:0;"></body>
嵌入式样式表   <style type="text/css"></style>   需要将样式放在<head></head>中
引入式样式表    <link rel="StyleSheet" type="text/css" href="style.css">

Within the chain stylesheet
Here Insert Picture Description

Embedded style sheets
Here Insert Picture Description
introduction of style sheets
Here Insert Picture DescriptionHere Insert Picture Description

Guess you like

Origin blog.csdn.net/weixin_41620505/article/details/93635739