1. =======HTML常用代码=======
  2. ------图象和文字的对齐------

  3.     <img src="URL" align="#"> #=top上, middle中, bottom下。

  4. ------图象在页面中的对齐/布局-------

  5.     <img src=URL align="#">#=left左,right右。这里表示文字在图片下面。<img src=URL align=left vspace=10 hspace=20>vspace与hspace表示距离。

  6. ------表格 ,跨多列的表元----------

  7.     <td colspan=#> #=列的数目 跨多行的表元 :<th rowspan=#> #=行的数目。

  8. -------表格的标题---------------

  9.      <caption align=#>内容 </caption> #=left左, center中, right右。
  10.      <aption valign=#>内容</caption> #=top, bottom,表示标题在表格下面。

  11. --------背景音乐-------------

  12.      <bgsound src="168.mid" loop="5"> #=WAV 文件的 URL。#=填数字,如果填-1,表示一直播放。

  13. ---------会移动的文字------------

  14. 方向:direction=#  #=left左, right右。<marquee direction=left>右向左移</marquee>,<marquee direction=right>左向右移</marquee>。
  15. 方式: bihavior=#   #=scroll, slide, alternate。<marquee behavior=scroll>一圈一圈绕着走</marquee>,<marquee behavior=slide>只走一次就歇了</marquee>,<marquee behavior=alternate>我来回走耶</marquee>。
  16. 带颜色背景,鼠标经过文字停住:<marquee bgcolor=aaaaee>啦啦啦,我会移动耶!</marquee>
  17. 空白:hspace=# vspace=#  #=数字。示范:<marquee hspace=20 vspace=20 width=150 bgcolor=ffaaaa align=center>啦啦啦,我会移动耶!</marquee>大家好!


  18. ==========CSS常用代码===========

  19. 字体颜色 : color : #00903A;
  20. 背景颜色 : background-color : #7CFFE7;

  21. --------------------------------------------------------------------------------

  22. 边框宽度 : border-width : 5px;
  23. 上边宽度 : border-top-width : 5px;
  24. 左边宽度 : border-left-width : 5px;
  25. 右边宽度 : border-right-width : 5px;
  26. 底边宽度 : border-bottom-width : 5px;

  27. --------------------------------------------------------------------------------

  28. 边框颜色 : border-color : #000FF4;
  29. 上边颜色 : border-top-color : #10FF01;
  30. 左边颜色 : border-left-color : #FF3B04;
  31. 右边颜色 : border-right-color : #FF3CF3;
  32. 底边颜色 : border-bottom-color : #00D0C3;

  33. --------------------------------------------------------------------------------

  34. 边框样式 : border-style : double; 可替换 dashed; dotted; none;  
  35. 上边样式 : border-top-style : solid;   
  36. 左边样式 : border-left-style : inset;
  37. 右边样式 : border-right-style : ridge;   
  38. 底边样式 : border-bottom-style : solid;   

  39. --------------------------------------------------------------------------------

  40. 整体宽度 : width : 5px;  
  41. 整体高度 : height : 5px;  
  42. 溢出选项 : overflow : visible;  可替换 hidden; scroll; auto;

  43. --------------------------------------------------------------------------------

  44. 内侧边距 : padding : 5px;   
  45. 上内边距 : padding-top : 5px;  
  46. 左内边距 : padding-left : 5px;  
  47. 右内边距 : padding-right : 5px;  
  48. 底内边距 : padding-bottom : 5px;  

  49. --------------------------------------------------------------------------------

  50. 外侧边距 : margin : 5px;   
  51. 上外边距 : margin-top : 5px;   
  52. 左外边距 : margin-left : 5px;   
  53. 右外边距 : margin-right : 5px;   
  54. 底外边距 : margin-bottom : 5px;   

  55. --------------------------------------------------------------------------------

  56. 文字字体 : font-family : fantasy;   
  57. 文字大小 : font-size : 12pt;   
  58. 文字粗细 : font-weight : bold;
  59.                 font-weight的值有normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
  60. 文字样式 : font-style : italic;   
  61. 文字变量 : line-height : 110%;      

  62. --------------------------------------------------------------------------------

  63. 清除属性 : clear : left;  可替换 right;  both;  none;
  64. 浮动属性 : float : left;  可替换 right;  none;
  65. 水平排列 : text-align : left; 可替换  right;  center;  justify;
  66. 文本修饰 : text-decoration : underline;  可替换  overline;  underline overline;  line-through;  blink;
  67. 文本缩进 : text-indent : 5em;   
  68. 文字间距 : letter-spacing : 5px;   
  69. 字母间距 : word-spacing : 5px;   
  70. 文本转换 : text-transform : capitalize;  可替换  lowercase;  uppercase;  
  71. 垂直排列 : vertical-align : baseline;    可替换  top; middle; bottom; text-top; text-bottom; super; sub; 3em; 30%;  

  72. --------------------------------------------------------------------------------

  73. 背景图片 : background-image : url(tianyi.gif);   
  74. 背景拉伸 : background-repeat : repeat;   可替换   repeat-x; repeat-y; no-repeat;  
  75. 背景定位 : background-position : left;   可替换   right; top; left top; right bottom; 30% 50%;
  76. 附加属性 : background-attachment : fixed; 可替换  scroll;   

  77. --------------------------------------------------------------------------------

  78. 显示属性 : display : none; 可替换  block; inline; run-in; compact; list-item; marker;   
  79. 是否可见 : visibility : visible; 可替换  hidden;   
  80. 资源定位 : position : static;  可替换  relative; absolute; fixed;  
  81. 距离顶部 : top : 5px;
  82. 距离左边 : left : 5px;  
  83. 距离右边 : right : 5px;   
  84. 距离底边 : bottom : 5px;   
  85. 优先等级 : z-index : 5;
  86. 鼠标指针 : cursor : crosshair; 可替换  default; pointer; move; text; wait; help; n-resize; s-resize; w-resize; e-resize; ne-resize; nw-resize; se-resize; sw-resize;
posted @ 2010-03-12 23:18 小开的一天 阅读(89) 评论(0) 编辑
  1. ==========CSS常用代码===========  
  2.   
  3.  字体颜色 : color : #00903A;  
  4.  背景颜色 : background-color : #7CFFE7;  
  5.   
  6. --------------------------------------------------------------------------------  
  7.   
  8.  边框宽度 : border-width : 5px;  
  9.  上边宽度 : border-top-width : 5px;  
  10.  左边宽度 : border-left-width : 5px;  
  11.  右边宽度 : border-right-width : 5px;  
  12.  底边宽度 : border-bottom-width : 5px;  
  13.   
  14. --------------------------------------------------------------------------------  
  15.   
  16.  边框颜色 : border-color : #000FF4;  
  17.  上边颜色 : border-top-color : #10FF01;  
  18.  左边颜色 : border-left-color : #FF3B04;   
  19.  右边颜色 : border-right-color : #FF3CF3;  
  20.  底边颜色 : border-bottom-color : #00D0C3;  
  21.   
  22. --------------------------------------------------------------------------------  
  23.   
  24.  边框样式 : border-style : double; 可替换 dasheddottednone;   
  25.  上边样式 : border-top-style : solid;    
  26.  左边样式 : border-left-style : inset;   
  27.  右边样式 : border-right-style : ridge;    
  28.  底边样式 : border-bottom-style : solid;    
  29.   
  30. --------------------------------------------------------------------------------  
  31.    
  32.  整体宽度 : width : 5px;   
  33.  整体高度 : height : 5px;   
  34.  溢出选项 : overflow : visible; 可替换 hiddenscrollauto;  
  35.   
  36. --------------------------------------------------------------------------------  
  37.    
  38.  内侧边距 : padding : 5px;    
  39.  上内边距 : padding-top : 5px;   
  40.  左内边距 : padding-left : 5px;   
  41.  右内边距 : padding-right : 5px;   
  42.  底内边距 : padding-bottom : 5px;   
  43.   
  44. --------------------------------------------------------------------------------  
  45.    
  46.  外侧边距 : margin : 5px;    
  47.  上外边距 : margin-top : 5px;    
  48.  左外边距 : margin-left : 5px;    
  49.  右外边距 : margin-right : 5px;    
  50.  底外边距 : margin-bottom : 5px;    
  51.   
  52. --------------------------------------------------------------------------------  
  53.    
  54.  文字字体 : font-family : fantasy;    
  55.  文字大小 : font-size : 12pt;    
  56.  文字粗细 : font-weight : bold;    
  57.  文字样式 : font-style : italic;    
  58.  文字变量 : line-height : 110%;     
  59.   
  60. --------------------------------------------------------------------------------  
  61.    
  62.  清除属性 : clear : left; 可替换 rightbothnone;  
  63.  浮动属性 : float : left; 可替换 rightnone;   
  64.  水平排列 : text-align : left; 可替换 rightcenterjustify;  
  65.  文本修饰 : text-decoration : underline; 可替换 overlineunderline overlineline-throughblink;   
  66.  文本缩进 : text-indent : 5em;    
  67.  文字间距 : letter-spacing : 5px;    
  68.  字母间距 : word-spacing : 5px;    
  69.  文本转换 : text-transform : capitalize; 可替换 lowercaseuppercase;   
  70.  垂直排列 : vertical-align : baseline;  可替换 topmiddlebottomtext-toptext-bottomsupersub3em30%;   
  71.   
  72. --------------------------------------------------------------------------------  
  73.    
  74.  背景图片 : background-image : url(tianyi.gif);    
  75.  背景拉伸 : background-repeat : repeat;  可替换  repeat-xrepeat-yno-repeat;   
  76.  背景定位 : background-position : left;  可替换  righttopleft topright bottom30% 50%;   
  77.  附加属性 : background-attachment : fixed; 可替换 scroll;    
  78.   
  79. --------------------------------------------------------------------------------  
  80.    
  81.  显示属性 : display : none; 可替换 blockinlinerun-incompactlist-itemmarker;    
  82.  是否可见 : visibility : visible; 可替换 hidden;    
  83.  资源定位 : position : static; 可替换 relativeabsolutefixed;   
  84.  距离顶部 : top : 5px;   
  85.  距离左边 : left : 5px;   
  86.  距离右边 : right : 5px;    
  87.  距离底边 : bottom : 5px;    
  88.  优先等级 : z-index : 5;  
  89.  鼠标指针 : cursor : crosshair; 可替换 defaultpointermove; text; waithelpn-resizes-resizew-resizee-resizene-resizenw-resizese-resizesw-resize;   
  90.   
  91.   
  92.   
  93. 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/lenhan12345/archive/2006/12/22/1453079.aspx  
posted @ 2010-03-12 23:12 小开的一天 阅读(71) 评论(0) 编辑
常用代码结构:

div:主要用于布局,分割页面的结构
ul/ol:用于无序/有序列表
span:没有特殊的意义,可以用作排版的辅助,例如:

<li><span>(4.23)</span>隐居豆腐店</li>
然后在css中定义span为右浮动,实现了日期和标题分两侧显示的效果

h1-h6:标题
h1-h6 根据重要性依次递减
h1  为最重要的标题

label:为了使你的表单更有亲和力而且还能辅助表单排版的好东西,例如:

<label for="user-password">密 码</label>
<input type="password" name="password" id="user-password" />
fieldset & legend:fildset套在表单外,legend用于描述表单内容。例如:
<form>
<fieldset>
<legend>title</legend>
<label for="user-password">密 码</label>
<input type="password" name="password" id="user-password" />
</fieldset>
</form>
dl,dt,dd:当页面中出现第一行为类似标题/简述,然后下面为详细描述的内容时应该使用该标签,例如:

<dl>
<dt>什么是CSS?</dt>
<dd>CSS就是一种叫做样式表(stylesheet)的技术。也有的人称之为层叠样式表(Cascading Stylesheet)。<dd>
<dt>什么是XHTML?</dt>
< dd>XHTML是一个基于XML的置标语言,看起来与HTML有些想像,只有一些小的但重要的区别。可以这样看,XHTML就是一个扮演着类似 HTML的角色的XML。本质上说,XHTML是一个桥接(过渡)技术,结合了XML(有几分)的强大功能及HTML(大多数)的简单特性。</dd>
</dl>
C #content

S #subcol

M #maincol

X #xcol

这是纵向布局的XHTML结构,c-smx表示网页有三个纵栏, c-sm表示有两个纵栏, c-mx表示有两个纵栏其中一个是附属的, c-m表示一个纵栏。

其中在三纵栏的布局需要分为两层 第一层是#subcol与#main第二层是#main中的#maincol与#xcol。

自定义命名:
根据w3c网站上给出的,最好是用意义命名
比如:是重要的新闻高亮显示(像红色)
有两种

.red{color:red}
.important-news{color:red}
很显然第二种传达的意义更加明确,所以尽量不要用意义不明确的作为自己自定义的名字

常用的CSS命名规则:

头:header  内容:content/container  尾:footer  导航:nav  侧栏:sidebar

栏目:column  页面外围控制整体布局宽度:wrapper  左右中:left right center

登录条:loginbar  标志:logo  广告:banner  页面主体:main  热点:hot

新闻:news  下载:download  子导航:subnav  菜单:menu

子菜单:submenu  搜索:search  友情链接:friendlink  页脚:footer

版权:copyright  滚动:scroll  内容:content  标签页:tab

文章列表:list  提示信息:msg  小技巧:tips  栏目标题:title

加入:joinus  指南:guild  服务:service  注册:regsiter

状态:status  投票:vote  合作伙伴:partner

(二)注释的写法:

  /* Footer */

  内容区

  /* End Footer */

(三)id的命名:

(1)页面结构

  容器: container  页头:header  内容:content/container

  页面主体:main  页尾:footer  导航:nav

  侧栏:sidebar  栏目:column  页面外围控制整体布局宽度:wrapper

  左右中:left right center

(2)导航

  导航:nav  主导航:mainbav  子导航:subnav

  顶导航:topnav  边导航:sidebar  左导航:leftsidebar

  右导航:rightsidebar  菜单:menu  子菜单:submenu

  标题: title  摘要: summary

(3)功能

  标志:logo  广告:banner  登陆:login  登录条:loginbar

  注册:regsiter  搜索:search  功能区:shop

  标题:title  加入:joinus  状态:status  按钮:btn

  滚动:scroll  标签页:tab  文章列表:list  提示信息:msg

  当前的: current  小技巧:tips  图标: icon  注释:note

  指南:guild 服务:service  热点:hot  新闻:news

  下载:download  投票:vote  合作伙伴:partner

  友情链接:link  版权:copyright

(四)class的命名:

(1)颜色:使用颜色的名称或者16进制代码,如

  .red { color: red; }

  .f60 { color: #f60; }

  .ff8600 { color: #ff8600; }

(2)字体大小,直接使用’font+字体大小’作为名称,如

  .font12px { font-size: 12px; }

  .font9pt {font-size: 9pt; }

(3)对齐样式,使用对齐目标的英文名称,如

  .left { float:left; }

  .bottom { float:bottom; }

(4)标题栏样式,使用’类别+功能’的方式命名,如

  .barnews { }

  .barproduct { }

注意事项::

  1.一律小写;

  2.尽量用英文;

  3.不加中杠和下划线;

  4.尽量不缩写,除非一看就明白的单词.

  主要的 master.css  模块 module.css  基本共用 base.css

  布局,版面 layout.css  主题 themes.css  专栏 columns.css

  文字 font.css  表单 forms.css  补丁 mend.css  打印 print.css

<$ 该文章转载自 http://www.oujiebin.cn/ $>
posted @ 2010-03-12 23:08 小开的一天 阅读(102) 评论(0) 编辑