html的基本概念:
1.HTML不是一种编程语言,而是一种标记语言。
2.HTML使用标记标签来描述网页。
3.<html>与</html>之间的文本是描述网页的。
4.<body>与</body>之间的文本是描述可见的页面内容的。
5.<p>与</p>之间的文本被显示为段落。
基本的html标签
1.html的标题是通过<h1> - <h6>等标签来进行定义的,<h1>定义最大标题,<h6>定义最小的标题,
应该将 h1 用作主标题(最重要的),其后是 h2(次重要的),再其次是 h3,以此类推。。
<h1>This is a heading</h1> <h2>This is a heading</h2> <h3>This is a heading</h3>
2.html段落通过<p>标签进行定义。
<p>This is a paragraph.</p> <p>This is another paragraph.</p>
3.html链接是通过<a></a>标签来定义的(在href属性里指定链接的地址)。
<a href = "http://www.w3school.com.cn">This is a link</a>
4.html图片是通过<img>标签来定义的。
<img src="E:\colors.png" width="104" height="142" />
html元素
1.html元素是指从开始标签到结束标签的所有代码。
2.html标签对大小写不敏感:<P>等同于<p>(推荐小写)。
html属性
1.html标签可以拥有属性。属性总是以名称/值对的形式出现,比如:name = "value"。
2.属性总是在html元素的开始标签中规定的。
属性例子:
标题居中:<h1 align = "center">
背景颜色:<body bgcolor = "yellow">
3.属性和属性值对大小写不敏感(推荐小写)。
4.属性值始终被包含在引号内,一般使用双引号,不过如果属性值本身就含有双引号,那么您必须使用单引号。
例如:name = ‘my name is “wdy” ’。
html参考手册和标签地址:http://www.w3school.com.cn/tags/tag_comment.asp
html水平线
<hr />标签在html页面中创建水平线。
例如:
<p>this is a</p>
<hr />
<p>this is b</p>
<hr />
<p>this is c</p>
html注释
注释代码,浏览器会忽略注释,不会显示他们。
例如:
< ! - - this is a comment - - >
html换行
如果您希望在不产生一个新的段落的情况下进行换行,可以使用<br/>标签。
例如:
<p> this is <br/> a <br/> b </p>
注意:对于html,您无法在html代码中添加额外的空格或换行来改变输出的效果。
当显示页面时,浏览器会移多余的空格和空行,所有连续的空格和空行被视作一个空格。
html文本格式化
1.文本格式化标签
标签 | 描述 |
---|---|
<b> | 定义粗体文本。 |
<big> | 定义大号字。 |
<em> | 定义着重文字。 |
<i> | 定义斜体字。 |
<small> | 定义小号字。 |
<strong> | 定义加重语气。 |
<sub> | 定义下标字。 |
<sup> | 定义上标字。 |
<ins> | 定义插入字。 |
<del> | 定义删除字。 |
<html>
<body>
<b>This text is bold</b>
<br />
<strong>This text is strong</strong>
<br />
<big>This text is big</big>
<br />
<em>This text is emphasized</em>
<br />
<i>This text is italic</i>
<br />
输出的结果:
2.预格式文本,使用<pre></pre>标签对空行和空格进行控制(此标签里不会移除多余的空格和空行)。
例子:
http://www.w3school.com.cn/tiy/t.asp?f=html_preformattedtext
3.“计算机输出”标签,改变字体。
标签 | 描述 |
---|---|
<code> | 定义计算机代码。 |
<kbd> | 定义键盘码。 |
<samp> | 定义计算机代码样本。 |
<tt> | 定义打字机代码。 |
<var> | 定义变量。 |
<pre> | 定义预格式文本。 |
<listing> | 不赞成使用。使用 <pre> 代替。 |
<plaintext> | 不赞成使用。使用 <pre> 代替。 |
<xmp> | 不赞成使用。使用 <pre> 代替。 |
例子:
http://www.w3school.com.cn/tiy/t.asp?f=html_computeroutput
4.地址:在html文件中写地址
例子:
http://www.w3school.com.cn/tiy/t.asp?f=html_address
5.此例子演示如何实现缩写或首字母缩写。
例如:
http://www.w3school.com.cn/tiy/t.asp?f=html_abbracronym
6.倒序输出文字
例如:
http://www.w3school.com.cn/tiy/t.asp?f=html_bdo
7.块引用。
引用、引用和术语定义
标签 | 描述 |
---|---|
<abbr> | 定义缩写。 |
<acronym> | 定义首字母缩写。 |
<address> | 定义地址。 |
<bdo> | 定义文字方向。 |
<blockquote> | 定义长的引用。 |
<q> | 定义短的引用语。 |
<cite> | 定义引用、引证。 |
<dfn> | 定义一个定义项目。 |
例如:
http://www.w3school.com.cn/tiy/t.asp?f=html_quotations
8.删除文字和插入文字效果。
例如:
http://www.w3school.com.cn/tiy/t.asp?f=html_delins