Front-end Overview
Hypertext Markup Language (English: HyperText Markup Language, referred to as: HTML) is a standard markup language used to create web pages.
You can use HTML to build your own WEB site. HTML runs on the browser and is parsed by the browser.
Server code:
#!/usr/bin/env?python
#?-*-?coding:utf-8?-*-?
#Author:?nulige
import?socket
def?main():
????sock?=?socket.socket(socket.AF_INET,?socket.SOCK_STREAM)
????sock.bind(('localhost',8080))
????sock.listen(5)
????while?True:
????????connection,?address?=?sock.accept()
????????buf?=?connection.recv(1024)
????????f=open("test.html","rb")??#以讀的方式打開(kāi)test.html文件
????????data=f.read()
????????connection.sendall(bytes("HTTP/1.1?201?OK\r\n\r\n","utf8"))
????????connection.sendall(data)
????????connection.close()
if?__name__?==?'__main__':
????main()
test.html code
nbsp;html>
????<meta>
????<title>nulige</title>
????<title>oldboy</title>
????<link>
????<link>
????<script></script>
<h1>hello?world</h1>>
<h2>hello?world</h2>>
<input>
<p>img?src="file:///D:/python/day42/1.jpg"?width="120"?height="80"?align=</p>
<h1>hello?h1</h1>
<div>style</div>
<!--<script>-->
????<!--alert(window.top.document.compatMode)-->
<!--</script>-->
The client is the browser. When accessing test.html through the browser, the effect is as follows:

Example 2: Access Jingdong website

Access Jingdong’s server schematic diagram from the browser
html css js is called: The Three Musketeers of the Internet
Going online: actually downloading web pages
Browser: just an interpreter
There are two common modes:
One is cs mode: c: client s:server
One is bs mode: b: browser s: server
Tag language:
Tags are divided into: self-closing tags and non-closing tags
Block-level tags: only occupy a small area of ??their own font
Inline tags: occupy one line
What is HTML?
htyper text markup language Hypertext markup language
Hypertext: It means that the page can contain pictures, links, and even non-text elements such as music and programs.
Markup language: A language composed of tags (tags).
Web page==HTML document, parsed by the browser, used for display
Static web page: Static resources, such as xxx.html
Dynamic web page: The html code is dynamically generated by a certain development language based on user requests
html document tree structure diagram:

What is a tag
is composed of a pair of words enclosed by angle brackets For example: *The words in all tags cannot start with The
tag is not case-sensitive. and . It is recommended to use lowercase. The
tag is divided into two parts: the opening tag and the closing tag . The part between the two tags is called the tag body.
Some tag functions are relatively simple. Just use one tag. This kind of tag is called a self-closing tag. For example:

tags can be nested. But they cannot be cross-nested.
The attributes of the
tag usually appear in the form of key-value pairs. For example, the name="alex"
attribute can only appear in the start tag or In self-closing tags,
attribute names are all lowercase. *Attribute values ??must be wrapped in double quotes or single quotes. For example, name="alex"
If the attribute value is exactly the same as the attribute name, directly Just write the attribute name. For example, readonly
Example:
?
<input>
tag
Due to historical reasons, various browsers have different differences in rendering the page. There are differences, and even the same browser renders the page differently in different versions. Before the
W3C standard was introduced, browsers did not have unified standards for rendering pages, resulting in differences (Quirks mode or Compatibility
Mode); due to the introduction of the W3C standard, browsers have unified rendering of pages The standard (CSScompat or Strict mode is also called Standards
mode), this is the simplest difference between the two.
After the W3C standard was launched, browsers began to adopt the new standard, but there was a problem: how to ensure that old web pages could continue to be browsed. Before the standard came out,
many pages were written based on the old rendering method , if the standard is used for rendering, it will cause the page to display abnormally. In order to maintain browser rendering compatibility and enable pages before
to be browsed normally, browsers retain the old rendering method (such as Microsoft's IE). In this way, Quircks mode
and Standars mode are produced in browser rendering. The two rendering methods coexist in one browser.
window.top.document.compatMode:
//BackCompat:怪異模式,瀏覽器使用自己的怪異模式解析渲染頁(yè)面。?
//CSS1Compat:標(biāo)準(zhǔn)模式,瀏覽器使用W3C的標(biāo)準(zhǔn)解析渲染頁(yè)面。
Usage example:
?<script>
alert(window.top.document.compatMode)
</script>
This attribute will be recognized and used by the browser, but if your page does not have a DOCTYPE declaration, then compatMode defaults to BackCompat,
This That is the beginning of the devil - the browser parses and renders the page in its own way, so different styles will be displayed in different browsers.
If you add to your page, it is equivalent to turning on the standards mode, and the browser must parse and render according to W3C's
standards page, so that your page will appear the same in all browsers.
This is what does.
head tag
? ? ? ? ?meta標(biāo)簽的組成:meta標(biāo)簽共有兩個(gè)屬性,它們分別是http-equiv屬性和name 屬性,不同的屬性又有不同的參數(shù)值,這些不同的參數(shù)值就實(shí)現(xiàn)了不同的網(wǎng)頁(yè)功能。
? ? ? ? 1: name屬性主要用于描述網(wǎng)頁(yè),與之對(duì)應(yīng)的屬性值為content,content中的內(nèi)容主要是便于搜索引擎機(jī)器人查找信息和分類信息用的。 ? ??
<meta>
?
<meta>
? ? ? ? 2: http-equiv顧名思義,相當(dāng)于http的文件頭作用,它可以向?yàn)g覽器傳回一些有用的信息,以幫助正確和精確地顯示網(wǎng)頁(yè)內(nèi)容,與之對(duì)應(yīng)的屬性值為content, ? ? ? ? ? ? ?content中的內(nèi)容其實(shí)就是各個(gè)參數(shù)的變量值。 ??
?//(注意后面的引號(hào),分別在秒數(shù)的前面和網(wǎng)址的后面)
?
<meta>
?
<meta>
注意:X-UA-Compatible(兼容:IE6 and IE7)
每個(gè)主要版本IE新增的功能都是為了讓瀏覽器更容易使用、增加安全性及更支持業(yè)界標(biāo)準(zhǔn)。以這些作為IE的特色,其中
一個(gè)風(fēng)險(xiǎn)就是舊版本網(wǎng)站無(wú)法正確的顯示。
為了將這個(gè)風(fēng)險(xiǎn)降到最低,IE6允許網(wǎng)頁(yè)開(kāi)發(fā)人員選擇IE編譯和顯示他們網(wǎng)頁(yè)的方式。"Quirks?mode"為預(yù)設(shè),這會(huì)
使頁(yè)面以舊版本瀏覽器的視點(diǎn)顯示,"Standards?mode"(也稱為"strict?mode")特點(diǎn)是支持業(yè)界標(biāo)準(zhǔn)最為完善。
然而要利用這個(gè)增強(qiáng)的支持功能,網(wǎng)頁(yè)必須包含恰當(dāng)?shù)闹噶睢?
若一個(gè)網(wǎng)頁(yè)沒(méi)有包含指令,IE6會(huì)將它以quirks?mode顯示。若網(wǎng)頁(yè)包含有效的指令但瀏
覽器無(wú)法辨識(shí),IE6會(huì)將它以IE6?standards?mode顯示。因?yàn)樯贁?shù)網(wǎng)站已經(jīng)包含指令,兼容性模式的
切換相當(dāng)成功。這使網(wǎng)頁(yè)開(kāi)發(fā)人員能選擇將他們的網(wǎng)頁(yè)轉(zhuǎn)移為standards?mode的最佳時(shí)機(jī)。
隨著時(shí)間經(jīng)過(guò),更多網(wǎng)站開(kāi)始使用standards?mode。它們也開(kāi)始使用IE6的特性和功能來(lái)檢測(cè)IE。舉例來(lái)說(shuō),IE6
不支持universal?selector(即css之全局選擇器?*?{}),一些網(wǎng)站便使用它來(lái)針對(duì)IE做特定的對(duì)應(yīng)。
當(dāng)?IE7增加了對(duì)全域選擇器的支持,那些依賴IE6特點(diǎn)的網(wǎng)站便無(wú)法偵測(cè)出這個(gè)新版本的瀏覽器。因此那些針對(duì)IE的
特定對(duì)應(yīng)無(wú)法應(yīng)用于IE7,造成這些網(wǎng)站便無(wú)法如他們預(yù)期的顯示。由于只支持兩種兼容性模式,受到影
響的網(wǎng)站擁有者被迫更新他們的網(wǎng)站使其能支持IE7。
IE8?比之前的任何版本瀏覽器都更支持業(yè)界標(biāo)準(zhǔn),因此針對(duì)舊版本瀏覽器設(shè)計(jì)的網(wǎng)頁(yè)可能無(wú)法如預(yù)期般呈現(xiàn)。為了幫
助減輕所有問(wèn)題,IE8引入文件兼容性的概念,使你能選擇你的網(wǎng)頁(yè)設(shè)計(jì)要對(duì)應(yīng)的特定IE版本。文件兼容性在IE8增加
了一些新的模式,這些模式能告訴瀏覽器如何解析和編譯一個(gè)網(wǎng)頁(yè)。若你的網(wǎng)頁(yè)無(wú)法在?ie8正確的顯示,你可以更新
你的網(wǎng)站使它支持最新的網(wǎng)頁(yè)標(biāo)準(zhǔn)(優(yōu)先選項(xiàng))或在你的頁(yè)面上新增一個(gè)meta元素用于告訴IE8如何依照舊版本瀏覽器
編譯你的頁(yè)面。
這能讓你選擇將你的網(wǎng)站更新支持IE8新特點(diǎn)的時(shí)機(jī)。
當(dāng)?Internet?Explorer?8?遇到未包含?X-UA-Compatible?標(biāo)頭的網(wǎng)頁(yè)時(shí),它將使用??指令來(lái)確
定如何顯示該網(wǎng)頁(yè)。?如果該指令丟失或未指定基于標(biāo)準(zhǔn)的文檔類型,則?Internet?Explorer?8?將以?IE5?模式
(Quirks?模式)顯示該網(wǎng)頁(yè)。
非meta標(biāo)簽
????<title>nulige</title>
????<link>
????<link>
????<script></script>
body標(biāo)簽
設(shè)置標(biāo)簽背景色
<h3 style="padding: 2px 0px 2px 10px; font-size: 15px; line-height: 24px; background: #009acd; color: #ffffff; font-family: 'comic sans ms', 微軟雅黑, 宋體, 黑體, Arial; height: 24px; width: 507.47px; margin: 12px 0px !important;">body標(biāo)簽</h3>
一 基本標(biāo)簽(塊級(jí)標(biāo)簽和內(nèi)聯(lián)標(biāo)簽)
<hn>: n的取值范圍是1~6; 從大到小. 用來(lái)表示標(biāo)題. <h1> hello world <h1>
<p>: 段落標(biāo)簽. 包裹的內(nèi)容被換行.并且也上下內(nèi)容之間有一行空白. (塊級(jí)標(biāo)簽)
<b> <strong>: 加粗標(biāo)簽.
<strike>: 為文字加上一條中線.
<em>: 文字變成斜體.
<sup>和<sub>: 上角標(biāo) 和 下角表.
<br>:換行.
<hr>:水平線
<div>
<div> hello world</div> 就是什么都不做(重點(diǎn))
<span> :只占一小塊空間 (內(nèi)聯(lián)標(biāo)簽)
內(nèi)聯(lián)標(biāo)簽:只能嵌套內(nèi)聯(lián)標(biāo)簽
塊級(jí)標(biāo)簽:可以嵌套內(nèi)聯(lián)標(biāo)簽
示例:演示div標(biāo)簽
<div style="color: green; background-color: aquamarine;height: 100px;width: 50%;font-size: 40px;text-align: center">hello</div>
運(yùn)行效果:

塊級(jí)標(biāo)簽: