HTML学习笔记——基础知识
1.标签
1.title标签、网站关键词、网站描述、实现网页的跳转、单标签、对标签、p标签
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- title标签 --> <title>我是title</title> <!-- 网站关键词 --> <meta name='keywords' content="切糕,卖切糕,卖切糕"/> <!-- 网站描述 --> <meta name='description' content="本网站介绍,要有可读性,100-200字"/> <!-- 5秒钟后跳转到百度网 --> <meta http-equiv='refresh' content="5;url='http://www.baidu.com'"/> </head> <body> <!-- 单标签 --> <img src="dog.jpg" width="100" height="150" title="图片"/> <!-- 对标签 --> <a href="http://www.baidu.com" id="link" class="test">百度</a> <strong>我是strong标签</strong> <p>我是p标签</p> </body> </html>
2.h1标签、h2标签、font标签、加粗文字、下划线、嵌套
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <!-- h1文章标题/只能用一次 --> <h1>我是p标签</h1> <!-- h2文章标题/可以用多次/权重较低 --> <h2>我是p标签</h2> <!-- font/color可以是英文或00ff00/size从1到7 --> <font color="red" size="7">我是font标签</font> <!-- 加粗文字 --> <strong>我是strong标签</strong> <!-- 嵌套 --> <font color="red"><u><del>红色文字加下划线</del></u></font> </body> </html>
3.pre标签、实体
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<!-- pre标签 -->
床前明月光
疑是地上霜
举头望明月
低头思故乡
<pre>
兰陵美酒郁金香
玉碗盛来琥珀光
但使主人能醉客
不知何处是他乡
</pre>
<!-- 实体 -->
ha标签的写法是这样的:<h1>h1实例</h1>
</body>
</html>
2.锚链接
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<!-- 从新的页面打开 -->
<!-- <a target="_blank" href="http://www.baidu.com">百度首页</a> -->
<!-- 锚链接用法 -->
<div id="top"></div>
<a href="#first">第一章节</a>
<a href="#second">第二章节</a>
<h2 id="first">第一章节</h2>
<p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p>
<h2 id="second">第二章节</h2>
<p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p><p>里面的没有内容</p