基本元素
<html>(标识是html文档)
<body>(页面显示出来的部分)
<head>(标题)
<p>(段落)
<hr />(水平线)
<br />(空行
<!— —>(注释)
HTML样式
style 对body, h, p都可以定义样式(即可作为他们的属性)
参数有:
- background-color:
style=“background-color: red” - font-family、font-size、color:
style=“font-family:verdana; font-size:20px; color:red” - text-align:style=“text-align: center”
HTML格式化
文本格式化
<b>: bold
<strong>: bold…?
<I>: italic
<em>: italic…?
<small> <big>
<sub>: subscript
<sup>: superscript
<del>: 删除线
<ins>: 插入字
计算机输出标签
<pre>: 预格式文本,保留源码的空格和换行
<code>: 定义计算机代码
<kbd>: 键盘码
<var>: 定义变量
引用
<bdo dir=“rtl”>: 支持输出方向从右到左,不知道有什么用哈哈
<abbr title="etcetera">etc.</abbr>: abbreviation缩写
<acronym title="world wide web">www</acronym>: acronym首字母缩写
<blockquote>: long quote(浏览器会缩进处理)
<q>: short quote
<cite>: 引用,可配合<a href="..."></a>使用,文本默认为斜体
表格
<table border="1">
<tr>
<th>Heading</th>
<th>Another Heading</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
border 选择是否显示边框,还有属性如cellpadding单元格边距、cellspacing单元格间距
tr 行
td 列
th 表头
对于跨行跨列的单元格,可用rowspan、colspan属性指明。
另外还有属性如bgcolor背景颜色、background背景图片可以对整个表格添加也可以对单元格添加。
此外,单元格内的对齐显然用align也是可以的。
最后,单元格的边框可以用frame属性指明,选项有box、below、above、hsides、vsides等。
列表
## unordered_list
<ul type="square">
<li>苹果</li>
<li>香蕉</li>
<li>柠檬</li>
<li>桔子</li>
</ul>
##ordered_list
<ol type="A">
<li>苹果</li>
<li>香蕉</li>
<li>柠檬</li>
<li>桔子</li>
</ol>
嵌套列表也是支持的