2010年10月25日星期一

XHTML checklist

1. XHTML = XML + HTML
  包含了所有的 HTML4.01 的元素,但是必须遵循 xml 的语法
2. XHTML 属性必须是嵌套的
  比如:
  <b><i>This text is bold and italic</b></i> 是错的
  <b><i>This text is bold and italic</i></b> 是对的
3. XHTML 元素必须是关闭的
4. XHTML 元素必须是小写的
5. XHTML 必须有一个根元素
6. XHTML 属性名必须小写
7. XHTML 属性值必须加引号
8. 属性不能简写
9. 比如:<input checked> 应该是: <input checked="checked" />
10. 假如要指定一个元素的值的内容的 lang 属性,则必须同时加 xml:lang
<div lang="it" xml:lang="it">Ciao bella!</div>
11. XHTML 规定了一些必须要有的属性
DOCTYPE html head title body
12. 有三种 DOCTYPE
1) 同时支持 HTML 与 XHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2) 严格遵循 XHTML 标记
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3) 如果想使用 HTML frame 时
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

13. 将一个网站转换成 XHTML 的过程
1) 增加 DOCTYPE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2) 将所有的元素/属性转换成小写,属性值加引号
3) 对空标签进行处理
<hr /> <br /> <img /> 或 <img ...></img>
4) 用 W3C 验证页面是否遵循 XHTML 标准
http://www.w3schools.com/xhtml/default.asp

2010年10月21日星期四

css 笔记

1. CSS 几种表示方式(应用范围):
1) html element selector,比如 p {color:red;text-align:center;}
2) id selector, ex. #para1{text-align:center;color:red;}
3) class Selector,ex. .center {text-align:center;}
4) html+class Selector,ex. p.centor{text-align:center;}

2. 插入 CSS 的三种方式
1) 外部 CSS
<link rel="stylesheet" type="text/css" href="mystyle.css" />
2) 内部 CSS
<style type="text/css">
hr {color:sienna;}
p {margin-left:20px;} /*20px ,but not 20 px*/
body {background-image:url("images/back40.gif");}
</style>
3) Inline CSS
<p style="color:sienna;margin-left:20px">This is a paragraph.</p>
3. 当对同一个元素使用了多个 css 时,使用指定的具体的,比如 Inline Css 优于 External Css
以下优先级 4>3>2>1,假如 外部 css 放在了 internal css 后面,则 外部 css 优先
1) Browser default
2) External style sheet
3) Internal style sheet (in the head section)
4) Inline style (inside an HTML element)

4. 属性值为 justify,会使该属性充满页面
比如: text-align:justify; 则可以使文字充满整个页面(类似于 word 中的左右对齐)

5. 设置字体大小
1) W3C 推荐用 em 表示大小,这样,在 IE 里也可以调整字体的大小(查看/文字大小),如果是 px 的话,IE 不支持调整
2) 1em 表示浏览器默认的字体大小,目前是 16px
3) 百分比与 em 共用
body {font-size:100%;}
h1 {font-size:2.5em;}
这种方式在所有的浏览器里都可以放大/缩小,以及调整字体大小
6. Link style
包括四种状态,a:hover 必须在 a:link,a:visited 后,而a:active 必须在 a:hover 后
a:link - a normal, unvisited link
a:visited - a link the user has visited
a:hover - a link when the user mouses over it
a:active - a link the moment it is clicked
7. 有许多属性在 IE 里不支持,除非有 !DOCTYPE 声明,所以总是保持 !DOCTYPE 声明是必要的

8. 当对齐 block 元素时,预定义 body 的 margin & padding 对浏览器兼容是必要的
body{margin:0;padding:0;}
9. @media Rule
在不同的用户接口上显示不同的内容
@media screen
{
p.test {font-family:verdana,sans-serif;font-size:14px;}
}
@media print
{
p.test {font-family:times,serif;font-size:10px;}
}
@media screen,print
{
p.test {font-weight:bold;}
}
10. 可以设置属性为选择器
ex.
[title]{color:blue;}
[title=W3Schools]{border:5px solid green;}
[title~=hello] { color:blue; } /*title Included hello*/
[lang|=en] { color:blue; } /* attribute lang include en */
input[type="text"]{width:150px;display:block;margin-bottom:10px;background-color:yellow;}

Resources:
1. http://www.w3schools.com/css/

2010年10月19日星期二

Mysql 表的存贮位置

Mysql 表的存贮位置

INNODB Engine 缺省的会将表数据及索引存贮在文件 ibdata1 下,ibdata 的位置与初始大小等是可以配置的,支持多个 ibdata 文件

MYISAM Engine 每个表的数据索引是存在独立的表文件中