HTML常用标签

根据w3cschool的课程学习所得

<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>

<h1>这是一个标题</h1>
h1 ~ h6

<p>这是一个段落。</p>

<a href="http://www.w3cschool.cn">这是一个链接</a>
<a href="#">链接文字</a>
<a href="//www.w3cschool.cn/" target="_blank">Visit W3CSchool!</a>
<a id="tips">Useful Tips Section</a>
<a href="#tips">Visit the Useful Tips Section</a>
<a href="//www.w3cschool.cn/html_links.html#tips"> Visit the Useful Tips Section</a>

<img src="w3cschool.png" alt="Big Boat" width="104" height="142">

空元素

<br />

<hr>

<!-- 这是一个注释 -->

<b></b> 与 <strong></strong>

<i></i> 与 <em></em>

头部元素<head>包含:<title>, <style>, <meta>, <link>, <script>, <noscript> 和 <base>

<title>Title of the document</title>

<base href="//www.w3cschool.cn/images/" target="_blank">

<link rel="stylesheet" type="text/css" href="mystyle.css">

<style type="text/css">
body {background-color:yellow}
p {color:blue}
</style>

<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">

在html中添加css的方式:
<p style="color:blue;margin-left:20px;">This is a paragraph.</p>
<style type="text/css">
body {background-color:yellow;}
</style>
<link rel="stylesheet" type="text/css" href="mystyle.css">

<table>…</table>
<th>…</th>
<tr>…</tr>
<td>…</td>

<ul>
<li>Coffee</li>
<li>Milk</li>
</ul>

<ol>
<li>Coffee</li>
<li>Milk</li>
</ol>

<dl>
<dt>Coffee</dt>
<dd>- black hot drink</dd>
<dt>Milk</dt>
<dd>- white cold drink</dd>
</dl>

块级元素 和 内联元素

块级元素:<h1>, <p>, <ul>, <table>, <div>等

<div>的作用:
可以把文档分割为独立的、不同的部分;
是块级元素,它是可用于组合其他HTML元素的容器;
没有特定的含义;
由于它属于块级元素,浏览器会在其前后显示折行;
如果与CSS一同使用,可用于对大的内容块设置样式属性;
另一个常见的用途是文档布局。它取代了使用表格定义布局的老式方法。使用 <table> 元素进行文档布局不是表格的正确用法。<table> 元素的作用是显示表格化的数据。

<span>的作用:
是内联元素,可用作文本的容器;
也没有特定的含义;
当与CSS一同使用时,可用于为部分文本设置样式属性;

表单元素包含:文本域(textarea)、下拉列表、单选框(radio-buttons)、复选框(checkboxes)等等;

<input type="text" name="firstname">
<input type="password" name="pwd">

<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female

<form>
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>

<input type="submit" value="Submit">

<iframe src="demo_iframe.htm" width="200" height="200"></iframe>

<script>
document.write("Hello World!")
</script>
<noscript>Sorry, your browser does not support JavaScript!</noscript>

字符实体

URL:统一资源定位器(Uniform Resource Locators)

scheme://host.domain:port/path/filename
scheme - 定义因特网服务的类型。最常见的类型是 http
host - 定义域主机(http 的默认主机是 www)
domain - 定义因特网域名,比如 w3cschool.cn
port - 定义主机上的端口号(http 的默认端口号是 80)
path - 定义服务器上的路径(如果省略,则文档必须位于网站的根目录中)。
filename - 定义文档/资源的名称

原文地址:https://www.cnblogs.com/kehuaihan/p/9017126.html