CSS控制DIV水平垂直方向剧中
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
body{position:relative; border:solid 1px #30F; height:600px; }
.box{ position:absolute; left:50%; top:50%; height:300px; width:400px; margin-top:-150px; margin-left:-250px;/*这个是本宽度度的一半*/ border:solid 1px #0F0; }
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
相关文档:
W3School:http://www.w3school.com.cn/css/index.asp
英文版网址:http://www.w3schools.com/css/default.asp
作为初学者,这是一定要收藏的网站。这就相当于一本CSS入门教程,在此可以学习每个标签,属性的用法和实例,可以自动动手实践代码。除了CSS的知识,这个网站还包括了大量其他网页开发语言教程和其他知识。
CSS ......
jQuery插件: jquery.widget.shadowbox.js
/**
* 一个简单的设置DIV阴影的插件
*
* 功能:
* 1. 根据阴影宽度自动调整外层容器宽度,以及透明度
* 2. 可定义ShadowBox的宽度和高度
* 3. 可用CSS样式表定义可视化样式
*
* @author joe.he <developerworks@163.com>
* @copyright irgs.cn
*/
(fun ......
CSS设置
<style type="text/css">
.box {
border:#eee solid 1px;
width:300px;
height:120px;
line-height:120px;
display:table-cell;
vertical-align:middle;
text-align:center;
}
</style>
1.文本
<div class="box">Sample text</div>
Sample text
2.图片(IE下在图片后面加一 ......
阿里巴巴的一款滑动分类菜单,效果很不错,但是使用了较多的图片,不过这些图片只是背景,不影响你修改菜单的文字,所以很值得大家使用,代码稍嫌多,学习CSS的朋友好好研究一下.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html ......
1.区别IE和Firefox
.title {
background:blue; /*Firefox */
background:red \9; /*IE6、IE7、IE8*/
}
2.区别IE6、IE7、IE8、Firefox
.title {
background:blue; /*Firefox */
background:red \9; /*IE6、IE7、IE8 */
*background:black; /*IE7 */
_background:orange; /*IE6 */
}
注意,无论怎样,都是FireFox ......