HTML 布局
<table border="0" width=“100%” cellpadding="10">
<tr>
<td width="50%" valign="top">
This is some text.
</td>
<td width="50%" valign="top">
Another text.
</td>
</tr>
</table
This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. | Another text. Another text. Another text. Another text. Another text. Another text. Another text. Another text. |
HTML 框架
通过使用框架,你可以在同一个浏览器窗口中显示不止一个页面。每份HTML文档称为一个框架,并且每个框架都独立于其他的框架。
使用框架的坏处:
- 开发人员必须同时跟踪更多的HTML文档
- 很难打印整张页面
1. 框架结构标签<frameset>
- 定义如何将窗口分割为框架
- 每个frameset定义了一系列行或列
- rows/columns的值规定了每行或每列占据屏幕的面积
2. 框架标签<frame>
- Frame标签定义了放置在每个框架中的html文档
<frameset cols="25%, 75%">
<frame src="frame_a.htm">
<frame src="frame_b.htm">
</frameset>
3. 提示
- 假如一个框架有可见边框,用户可以拖动边框来改变它的大小。为了避免这种情况发生,可以在<frame>标签中假如:noresize="noresize"
- 为不支持框架的浏览器添加<nframes>标签
- 不能将<body></body>和<frameset></frameset>同时使用。不过,假如添加包含一段文本的<noframes>标签,就必须将这段文字嵌套在<body></body>内
实例1. 使用<noframes>
<frameset cols="25%,50%,25%">
<frame src="/example/html/frame_a.html">
<frame src="/example/html/frame_b.html">
<frame src="/example/html/frame_b.htm">
<noframes>
<body>Your browser does not support frame!</body>
</noframes>
</frameset>
实例2. 混合框架结构
<frameset rows="50%, 50%">
<frame src="example/html/frame_a.html">
<frameset cols="25%, 75%">
<frame src="/example/html/frame_b.html">
<frame src="/example/html/frame_c.html">
</frameset>
</frameset>
实例3. 含有 noresize="noresize"属性的框架结构
<frameset cols="50%,*,25%">
<frame src="/example/html/frame_a.html" noresize="noresize" />
<frame src="/example/html/frame_b.html" />
<frame src="/example/html/frame_c.html" />
</frameset>
实例4. 导航框架
<frameset cols="120, *">
<frame src="/example/html/html_contents.html">
<frame src="/example/html/frame_a.html" name="showframe">
</frameset>
实例5. 内联框架
<iframe src="/i/eg_landscape.jpg"></iframe>
<p>一些老的浏览器不支持iframe</p>
<p>如果得不到支持,iframe是不可见的</p>
实例6. 跳转至框架内的一个指定的节
<frameset cols="20%,80%">
<frame src="/example/html/frame_a.html">
<frame src="/example/html/link.html#C10">
</frameset>
实例7. 使用框架导航跳转到指定的节
<frameset cols="180, *">
<frame src="/example/html/content.html">
<frame src="/example/html/link.html" name="showframe">
</frameset>
HTML 字体
在 HTML 中,字体标签是不被支持的。一般都认为,在今后版本的 HTML 中,这个标签会被清除出去。
即使很多人都在用它,我们都应该尽量避免它,而使用样式
设计文字的字体、尺寸、颜色:
<p style="font-family: verdana; font-size: 80%; color: green">
This is a paragraph with some text in it. This is a paragraph with some text in it. This is a paragraph with some text in it. This is a paragraph with some text in it.
</p>