发新话题
打印

[杂七杂八] html代码集

本主题由 小唐的糖 于 2008-5-4 04:07 AM 分类

html代码集

请无视那些序号…………它们是乱来的……一开始很认真得填代码,后来就懒了……一空行一种代码……
因为好像9x并不支持在帖子里用html代码,所以效果就展示不了了。
另外,请问有谁知道让文字闪光的代码……

HTML 文件结构(Document Structures)

以下是代码:
  • <html>...</html>
  • <head>...</head>
  • <body>...</body>
  • <HTML>
  • <HEAD>
  •     <title>, <base>, <link>, <isindex>, <meta>
  • </HEAD>
  • <BODY>
  •    HTML 文件的正文写在这里... ...
  • </BODY>
  • </HTML>



语言字符集(Charsets)的信息


以下是代码:
  • <meta http-equiv="Content-Type" c>
  • #=
  • us-ascii, iso-8859-1, x-mac-roman, iso-8859-2, x-mac-ce,
  • iso-2022-jp, x-sjis, x-euc-jp,
  • euc-kr, iso-2022-kr,
  • gb2312, gb_2312-80,
  • x-euc-tw, x-cns11643-1, x-cns11643-2, big5



可在 HTML 文件中设置 MIME 字符集信息。
您在浏览主页时,最好自己在浏览器的选项菜单内选择相应的语言(language encoding)。
但是如果 HTML 文件里写明了设置,浏览器就会自动设置语言选项。
尤其是主页里用到了字符实体(entities),则该主页就应该写明字符集信息。
否则,您在浏览该主页时,若未正确设置语言选项,显示将可能混乱。
背景色彩和文字色彩

以下是代码:
  • <body bgcolor=# text=# link=# alink=# vlink=#>



bgcolor --- 背景色彩
text --- 非可链接文字的色彩
link --- 可链接文字的色彩
alink --- 正被点击的可链接文字的色彩
vlink --- 已经点击(访问)过的可链接文字的色彩
#=rrggbb
色彩是用 16 进制的 红-绿-蓝(red-green-blue, RGB) 值来表示。
16 进制的数码有: 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f.

背景图象



以下是代码:
  • <body background="image-URL">
  • Non Scrolling Background <body bgproperties=FIXED>




页面空白(Margin)

页面左边的空白
以下是代码:
  • <body leftmargin=#>



页面上方的空白(天头)
以下是代码:
  • <body topmargin=#> #=margin amount



链接(Link)

基本语法

以下是代码:
  • <a href=http://www.9xfan.net/bbs/index.php> ... </a>这是一个<a href="samp/link.html">链接的例子</a>。



点一下带下划线的文字!
这是一个链接的例子。 点一下带下划线的文字!

开一个新的(浏览器)窗口 (Target Window)

以下是代码:
  • <a href="URL" target="Window_Name"> ... </a>
  • <a href="samp/window.html" target="window_name">
  • </a>




标尺线

以下是代码:
  • <hr>
  • <hr size=#>
  • <hr size=10>
  • <hr width=#>
  • <hr width=50>
  • <hr width=50%>
  • <hr align=#> #=left, right
  • <hr width=50% align=left>
  • <hr width=50% align=right>
  • <hr noshade>
  • <hr noshade>
  • <hr color=#>
  • #=rrggbb 16 进制 RGB 数码,或者是下列预定义色彩:
  • Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
  • Fuchsia, White, Green, Purple, Silver, Yellow, Aqua
  • <hr color="red">




标题字体(Header)

以下是代码:
  • <h#> ... </h#>


#=1, 2, 3, 4, 5, 6
<hn>---</hn> 这些标记显示黑体字。
<hn>---</hn> 这些标记自动插入一个空行,不必用 <p> 标记再加空行。
因此在一行中无法使用不同大小的字体。

字体大小

以下是代码:
  • <font size=#> ... </font>


#=1, 2, 3, 4, 5, 6, 7 or +#, -#

以下是代码:
  • <basefont size=#>


#=1, 2, 3, 4, 5, 6, 7

物理字体(Physical Style)

以下是代码:
  • <b>加粗</b>
  • <i>打斜</i>
  • <u>下划线</u>
  • <s>去除线</s>




指定“字体大小”的标记和“指定字体”的标记的组合使用


以下是代码:
  • <i><font size=5>
  •        <b>今天</b> 天气<font size=6> 真好!</font>
  • </font></i>



字体颜色

指定颜色

以下是代码:
  • <font color=#> ... </font>



#=rrggbb 16 进制数码,或者是下列预定义色彩:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua

文字的对齐(Alignment)

以下是代码:
  • <hn align=#>...</hn>
  • <p align=#>...</p> #=left, center, right
  • <h3 align=center>Hello<\h3>
  • <h3 align=right>Hello<\h3>




预格式化文本(Preformatted Text)

以下是代码:
  • <pre>...</pre>
  • <pre>
  • Please use your card.
  • VISA Master
  • <b>Here is an order form.</b>
  • <ul><li>Fax
  • <li>Air Mail</ul>
  • </pre>
  • Please use your card
  • VISA    Master
  • Here is an order form.
  • Fax
  • Air Mail
  • <listing>...</listing>
  • <listing>
  • Please use your card.
  • VISA Master
  • <b>Here is an order form.</b>
  • <ul><li>Fax
  • <li>Air Mail</ul>
  • </listing>
  • Please use your card.
  • VISA    Master
  • Here is order form.
  • Fax
  • Air Mail
  • <xmp>...</xmp>
  • <xmp>
  • Please use your card.
  • VISA Master
  • <b>Here is an order form.</b>
  • <ul><li>Fax
  • <li>Air Mail</ul>
  • </xmp>
  • Please use your card.
  • VISA    Master
  • <b>Here is order form.</b>
  • <ul><li>Fax
  • <li>Air Mail</ul>




空白(Spacer)


以下是代码:
  • <spacer type="horizontal" size=#>


#=水平空白宽度

以下是代码:
  • <spacer type="vertical" size=#>


#=竖直空白高度

闪烁

以下是代码:
  • <blink>...</blink>




链入图象的基本语法


以下是代码:
  • <img src=#>


#=图象的 URL

以下是代码:
  • <img alt=#>


#=在浏览器尚未完全读入图象时,在图象位置显示的文字。

图象和文字的对齐

以下是代码:
  • <img align=#>


#=top, middle, bottom

边框

以下是代码:
  • <img border=#>


#=value

基本语法

表单的基本语法

以下是代码:
  • <form action="url" method=*>
  • ...
  • ...
  • <input type=submit> <input type=reset>
  • </form>


*=GET, POST

表单中提供给用户的输入形式

以下是代码:
  • <input type=* name=**>



*=text, password, checkbox, radio, image, hidden, submit, reset
**=Symbolic Name for CGI script

文字输入和密码输入
*=text, password

<input type=*>
<input type=* value=**>

例:
<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>

<input type=* size=**>
<input type=* maxlength=**>

<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>

复选框(Checkbox) 和 单选框(RadioButton)

<input type=checkbox>
<input type=checkbox checked>
<input type=checkbox value=**>

<input type=radio value=**>
<input type=radio value=** checked>

列表框(Selectable Menu)

基本语法
<select name=*>
<option> ...
</select>

<option selected>
<option value=**>

<select size=**>

<select size=** multiple>
注意,是用 Ctrl 键配合鼠标实现多选。
(和 MS-WINDOWS 的 File Manager 一样)

文本区域
<textarea name=* rows=** cols=**> ... <textarea>

对于很长的行是否进行换行的设置(Word Wrapping)
<textarea wrap=off> ... </textarea>
不换行,是缺省设置。

<textarea wrap=soft> ... </textarea>
“软换行”,好象 MS-WORD 里的“软回车”。

<textarea wrap=hard> ... </textarea>
“硬换行”,好象 MS-WORD 里的“硬回车”。

跨多行、多列的表元(Table Span)
表格的基本语法
<table>...</table> - 定义表格
<tr> - 定义表行
<th> - 定义表头
<td> - 定义表元(表格的具体数据)
带边框的表格:
<table border>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>      
</table>

跨多列的表元 <th colspan=#>
<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>

跨多行的表元 <th rowspan=#>
<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>

表格尺寸设置

<table border=#>
边框尺寸设置:
<table border=10>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>      
</table>

<table border width=# height=#>
表格尺寸设置:
<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>

<table border cellspacing=#>
表元间隙设置:
<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>


<table border cellpadding=#>
表元内部空白设置:
<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>

表格内文字的对齐/布局

<tr align=#>
<th align=#> #=left, center, right
<td align=#>
<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>

<tr valign=#>
<th valign=#> #=top, middle, bottom, baseline
<td valign=#>
<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>


表格在页面中的对齐/布局(Floating Table)

<table align=left>
<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.

table align=right>
Food Drink Sweet
A B C
My favorites...
cookies, chocolates, and more.



<table vspace=# hspace=#> #=space value   
<table align="left" border vspace=20 hspace=30>
<tr><th>Food</th><th>Drink</th><th>Sweet</th>
<tr><td>A</td><td>B</td><td>C</td>
</table>
My favorites...<br>

表格的标题

<caption align=#> ... </caption> #=left, center, right
<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>

<caption valign=#> ... </caption> #=top, bottom
valign=top is default.
<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>

表格的色彩
表元的背景色彩和背景图象
<th bgcolor=#>
<th background="URL">   
表格边框的色彩
<table bordercolor=#>
表格边框色彩的亮度控制
<table bordercolorlight=#>
<table bordercolordark=#>

#=rrggbb 16 进制 RGB 数码, 或者是下列预定义色彩名称:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua

表格的分组显示(Structured Table)

按行分组
<thead> ... </thead>
- 表的题头
<tbody> ... </tbody>
- 表的正文
<tfoot> ... </tfoot>

按列分组
<colgroup align=#>
#=left, right, center

列的属性控制
<col span=#>
#=从左数起,具有指定属性的列的列数
<col align=#>
#=left, right, center

多窗口页面基本语法

<frameset> ... </frameset>
<frame src="url">
<noframes> ... </noframes>

各窗口的尺寸设置

<frameset cols=#>

特殊的 4 类操作(很有用!)
<a href=url target=_blank> 新窗口
<a href=url target=_self> 本窗口
<a href=url target=_parent> 父窗口
<a href=url target=_top> 整个浏览器窗口

边框色彩
<frameset bordercolor=#>
#=rrggbb 16 进制 RGB 数码, 或者是下列预定义色彩名称:
Black, Olive, Teal, Red, Blue, Maroon, Navy, Gray, Lime,
Fuchsia, White, Green, Purple, Silver, Yellow, Aqua
光影交錯 芳華未盡 幽藍冥火冰冷卻寧靜

TOP

话说这是很好的东西,我正想要这个.....
顶下下...

TOP

那个,请问知道闪光文字的代码吗……
光影交錯 芳華未盡 幽藍冥火冰冷卻寧靜

TOP

好长好晕啊。。。。。。。。。。。。。。。。
喜欢哈利波特的可以加哦! <group85397@msnzone.cn>
喜欢士兵突击的朋友都可以加哦! <group96739@msnzone.cn>




TOP

……………………我也没想到什么办法把它弄得不晕
光影交錯 芳華未盡 幽藍冥火冰冷卻寧靜

TOP

以前学过,现在忘光- -
太头晕了。

TOP

看来还是顶的有沙发坐坐哦!

提示: 作者被禁止或删除 内容自动屏蔽

TOP

哦~~~`
我正急着想要呢!
谢拉,哪天我请你吃饭,你要记得买单。
爱死波特



TOP

发新话题