1.页内跳转iframe
<ul>
<li><a href="1.html" target="iframe1">1</a></li>
<li><a href="2.html" target="iframe1">2</a></li>
</ul>
</ul>
<iframe name="iframe1" src="0.html"></iframe>
2.打开链接
<a href="url" target="_blank">新窗口中打开</a>
<a href="url" target="_parent">在原窗口中打开</a>
3.text元素设为只读
<input type="text" disabled readonly />
4.css技巧
默认样式值:* {margin: 0; padding: 0; background-color: transparent;}
css中子元素自动继承父元素的属性值
对同一元素的css定义有多种,以最近的定义为最优先
一个标签可以定义多个class
派生选择器:div p {}
组选择器:h1, h2 {}
不需要给背景图片加引号:background-image: url(images/a.gif)
正确的顺序指定连接样式:a:link, a:visited, a:hover, a:active
调试技巧:使用background,避免用border,因为border可能会改变div大小
5.div布局实例

<!DOCTYPE html> <html> <head> <style type="text/css"> #container { position: absolute; background-color: pink; left: 100px; top: 100px; right: 100px; bottom: 100px; } #header { height: 40px; background-color: yellow; } #content { position: absolute; background-color: silver; width: 100%; top: 40px; bottom: 40px; } #left { position: absolute; background-color: purple; width: 200px; height: 100%; } #right { position: absolute; background-color: purple; width: 200px; height: 100%; right: 0px; } #footer { position: absolute; width: 100%; height: 40px; bottom: 0; background-color: cyan; } </style> </head> <body> <div id="container"> <div id="header"></div> <div id="content"> <div id="left"></div> <div id="center"></div> <div id="right"></div> </div> <div id="footer"></div> </div> </body> </html>