| 科's profileiWaNtFlyPhotosBlogLists | Help |
|
January 09 css层叠样式(1)----植入样式表植入样式表:
所有的样式表信息都列于HTML文件的顶部:
<HTML> 链接到样式表上:
<HTML> (使用链接的样式表时,你无须使用注释标签。) 现在生成一个单另的文本文件,起名mystyles.css (或者其任何你喜欢的名字)。文件内容如下: H1 { color: green; font-family: impact } 如同发布HTML文件那样,将这个CSS文件布到你的服务器中。在浏览器中观看网时,你会发现浏览器将依照链接标签将有链接了的HTML网页按照样式表的规则示,在HREF属性中你可以选择使用绝对相对URL。
输入样式表:
输入外部样式表的方法同链接的方法类似。不同之处在于链接法不能同其它方法结合使用,但输入法则可以。例: <HTML> 而其中输入的 company.css文件内容如下: H1 { color: green; font-family: times } 在本例中,浏览器首先输入 company.css的规则 ( @import 必须打头), 然后加入移植的规则从而为这个网页产生规则集合。
在行内加入样式 <HTML>
分类
P.first { color: green } <P CLASS=first>The first paragraph, 你可以给类别起任何一种名字,但不要忘了在样式表规则中类别名称前加一个句号(即英文中的 .) 你还可以生成不加任何HTML标签的分类: .first { color: green } 这种方式更加灵活,因为现在我们可以将CLASS=first用于任何HTML标签,并应用到网页<BODY>中,而设定的文字将以绿色显示。 P B { color: red } <H1><B>Emma Thompson</B>, Actress 样式表的规则告诉浏览器只将所有<P>之内加重显示的文字以红色显示。所以,<P>之外标题的加重文字不会以红色显示,而<P>之内的文字则是。 P.first { color: green } /* green 屏幕就是一个战场,在一个HTML文件中,如果有3种不同的样式表规则都使用P作为其选择。输入的样式表指示浏览器将<P>文字用红色显示,而植入的样式表指示浏览器用蓝色显示,而行内样式表指示浏览器用黄色。
浏览器将按照上述顺序执行样式表的指令。
注意:正式的串接样式表规定对于串接顺序有更详细的规定。但由于执行规定Netscape Communicator 和Internet Explorer都不支持,所以本文中不再细述。 I { font-family: impact } <P>I think <I><FONT FACE="Times"> 该例中样式表规则要求浏览器使用Impact,但是传统的HTML<FONT FACE>标签要求用Times字体,一个很明显的传统。 html语法(10)----多窗口页面(Frames)基本语法<frameset> ... </frameset>
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| A | B | C |
<frameset rows=25%,25%,50%> <frame src="A.html"> <frame src="B.html"> <frame src="C.html"> </frameset>
<frameset cols=20%,*>
<frame src="A.html">
<frameset rows=40%,*>
<frame src="B.html">
<frame src="C.html">
</frameset>
</frameset>
| A | B |
| C |
<frameset cols=50%,50%> <frame src="A.html"> <frame src="B.html" name="HELLO"> </frameset>
| A | B |
<frameset rows=30%,*>
<frame src="Acol.html" frameborder=1>
<frameset cols=30%,*>
<frame src="Bcol.html" frameborder=0>
<frame src="Ccol.html" frameborder=0>
</frameset>
</frameset>
示例
(A 有边框,B、C 没有) | A | |
| B | C |
<frameset rows=30%,* framespacing=100>
<frame src="Acol.html">
<frameset cols=30%,*>
<frame src="Bcol.html">
<frame src="Ccol.html">
</frameset>
</frameset>
示例
| A | |
| B | C |
<frameset rows=30%,* bordercolor=red>
<frame src="Acol.html">
<frameset cols=30%,*>
<frame src="Bcol.html">
<frame src="Ccol.html">
</frameset>
</frameset>
示例
| A | |
| B | C |
<frameset cols=50%,50%>
<frame src="A.html">
<frame src="A.html"
marginwidth=50
marginheight=50>
</frameset>
示例
| AAAA | AA AA |
<center> <iframe src="A.html" name="window"> Here is a Floating Frame </iframe> <br><br> <a href="A.html" target="window">Load A</A><BR> <a href="B.html" target="window">Load B</A><BR> <a href="Ccol.html" target="window">Load C</A><BR> </center>
| Pre |
|---|
<table border height=100 width=200 align=center>
<tr><th bgcolor=ffaa00>Food</th>
<th bgcolor=Red>Drink</th>
<th rowspan=2 background="URL">Sweet</th>
<tr bgcolor=white><td>A</td><td>B</td>
</table>
| Food | Drink | Sweet |
|---|---|---|
| A | B |
<table cellspacing=5 border=5 bodercolor=#ffaa00> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table cellspacing=5 border=5
bordercolorlight=White bordercolordark=blue>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>
</table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border>
<thead>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
</thead>
<tbody>
<tr><td>A</td><td>B</td><td>C</td>
<tr><td>D</td><td>E</td><td>F</td>
</tbody>
</table>
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
<table border width=160>
<colgroup align=left>
<colgroup align=center>
<colgroup align=right>
<thead>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
</thead>
<tbody>
<tr><td>A</td><td>B</td><td>C</td>
<tr><td>D</td><td>E</td><td>F</td>
</tbody>
</table>
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
<table border width=160>
<colgroup>
<col align=center span=2>
<colgroup align=right>
<thead>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
</thead>
<tbody>
<tr><td>A</td><td>B</td><td>C</td>
<tr><td>D</td><td>E</td><td>F</td>
</tbody>
</table>
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
<table border frame=box>
<thead>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
</thead>
<tbody>
<tr><td>A</td><td>B</td><td>C</td>
<tr><td>D</td><td>E</td><td>F</td>
</tbody>
</table>
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F |
<table border rules=all>
<colgroup><col align=center span=2>
<colgroup align=right>
<thead>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
</thead>
<tbody>
<tr><td>A</td><td>B</td><td>C</td>
<tr><td>D</td><td>E</td><td>F</td>
</tbody>
<tbody>
<tr><td rowspan=3 align=right>Total $-00.0</td>
</tbody>
</table>
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F | |
| Total $-00.0 | |||
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F | |
| Total $-00.0 | |||
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F | |
| Total $-00.0 | |||
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F | |
| Total $-00.0 | |||
| Food | Drink | Sweet | |
|---|---|---|---|
| A | B | C | |
| D | E | F | |
| Total $-00.0 | |||
| Pre | Next |
|---|
<table border> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border> <tr><th colspan=3> Morning Menu</th> <tr><th>Food</th> <th>Drink</th> <th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Moring Menu | ||
|---|---|---|
| Food | Drink | Sweet |
| A | B | C |
<table border>
<tr><th rowspan=3> Morning Menu</th>
<th>Food</th> <td>A</td></tr>
<tr><th>Drink</th> <td>B</td></tr>
<tr><th>Sweet</th> <td>C</td></tr>
</table>
| Morning Menu | Food | A |
|---|---|---|
| Drink | B | |
| Sweet | C |
<table border=10> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border width=170 height=100> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border cellspacing=10> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border cellpadding=10> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border width=160>
<tr>
<th>Food</th><th>Drink</th><th>Sweet</th>
<tr>
<td align=left>A</td>
<td align=center>B</td>
<td align=right>C</td>
</table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border height=100>
<tr>
<th>Food</th><th>Drink</th>
<th>Sweet</th><th>Other</th>
<tr>
<td valign=top>A</td>
<td valign=middle>B</td>
<td valign=bottom>C</td>
<td valign=baseline>D</td>
</table>
| Food | Drink | Sweet | Other |
|---|---|---|---|
| A | B | C | D |
<table align="left" border> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table> My favorites...<br> cookies, chocolates, and more.
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table align="left" border> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table> My favorites...<br> cookies, chocolates, and more.
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border> <caption align=center>Lunch</caption> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
<table border> <caption valign=bottom>Lunch</caption> <tr><th>Food</th><th>Drink</th><th>Sweet</th> <tr><td>A</td><td>B</td><td>C</td> </table>
| Food | Drink | Sweet |
|---|---|---|
| A | B | C |
| Pre | Next |
|---|
*=GET, POST
*=text, password, checkbox, radio, image, hidden, submit, reset
**=Symbolic Name for CGI script
*=text, password, checkbox, radio, image, hidden, submit, reset
**=Symbolic Name for CGI script
*=text, password
<form action=/cgi-bin/post-query method=POST> 您的姓名: <input type=text name=姓名><br> 您的主页的网址: <input type=text name=网址 value=http://><br> 密码: <input type=password name=密码><br> <input type=submit value="发送"><input type=reset value="重设"> </form>
<form action=/cgi-bin/post-query method=POST> <input type=text name=a01 size=40><br> <input type=text name=a02 maxlength=5><br> <input type=submit><input type=reset> </form>
<form action=/cgi-bin/post-query method=POST>
<input type=checkbox name=水果1>
香蕉<p>
<input type=checkbox name=水果2 checked>
苹果<p>
<input type=checkbox name=水果3 value=橘子>
桔子<p>
<input type=submit><input type=reset>
</form><input type=radio value=**>
<input type=radio value=** checked><form action=/cgi-bin/post-query method=POST> <input type=radio name=水果> 香蕉<p> <input type=radio name=水果 checked> 苹果<p> <input type=radio name=水果 value=橘子> 桔子<p> <input type=submit><input type=reset> </form>隐藏表单的元素<input type=hidden value=*>
<form action=/cgi-bin/post-query method=POST> <input type=hidden name=add value=hoge@hoge.jp> Here is a hidden element. <p> <input type=submit><input type=reset> </form>列表框(Selectable Menu)基本语法
<form action=/cgi-bin/post-query method=POST>
<select name=fruits>
<option>香蕉
<option selected>苹果
<option value=My_Favorite>桔子
</select><p>
<input type=submit><input type=reset>
</form>
<select size=**>
<form action=/cgi-bin/post-query method=POST>
<select name=fruits size=3>
<option>香蕉
<option selected>苹果
<option value=My_Favorite>桔子
<option>桃子
</select><p>
<input type=submit><input type=reset>
</form>
<select size=** multiple>
注意,是用 Ctrl 键配合鼠标实现多选。
(和 MS-WINDOWS 的 File Manager 一样) <form action=/cgi-bin/post-query method=POST>
<select name=fruits size=3 multiple>
<option selected>香蕉
<option selected>苹果
<option value=My_Favorite>桔子
<option selected>桃子
</select><p>
<input type=submit><input type=reset>
</form>
文本区域
<textarea name=* rows=** cols=**> ... <textarea>
<form action=/cgi-bin/post-query method=POST>
<textarea name=comment rows=5 cols=60>
</textarea>
<P>
<input type=submit><input type=reset>
</form>
对于很长的行是否进行换行的设置(Word Wrapping)
<textarea wrap=off> ... </textarea>
“软换行”,好象 MS-WORD 里的“软回车”。
<textarea wrap=hard> ... </textarea>
“硬换行”,好象 MS-WORD 里的“硬回车”。
| Pre | Next |
|---|
| |false| |
|
|