易截截图软件、单文件、免安装、纯绿色、仅160KB

CSS 绝对定位学习

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> </title>
<meta name="description" content=" ">
<meta name="keywords" content=" ">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link href="css/basic.css?ver=01" mce_href="css/basic.css?ver=01" rel="stylesheet" type="text/css" />
<mce:script type="text/javascript" src="js/util.js" mce_src="js/util.js"></mce:script>
</head>
<body>
<mce:style type="text/css"><!--
.r{position:relative;width:300px;height:300px;border:1px solid #ccc;}
.a{background-color:red;height:25px;} /*普通div,按文档流*/
.a1, .a2, .a3, .a4{position:absolute; width:100px;height:100px;} /*设置绝对定位后,会寻找position设置为relative的祖先元素,然后以它为参照物,设置偏移位置,此处为他们的父元素class=r。如果向上寻找祖先元素,没有position设置为relative的元素,则以body元素为参照物*/
.a1{left:10px;top:30px;background-color:yellow;z-index:1} /*偏移位置,左10px ,上30px z-index为z轴的索引,即如果位置重叠,则z-index数量越大,在第三维位置越大*/
.a2{left:20px;top:40px;background-color:green;z-index:2}
.a3{left:30px;top:50px;background-color:blue;z-index:3}
.a4{right:-50px;bottom:-50px;background-color:purple;} /*设为绝对定位后,可以处以祖先元素之外*/
--></mce:style><style type="text/css" mce_bogus="1"> .r{position:relative;width:300px;height:300px;border:1px solid #ccc;}
.a{background-color:red;height:25px;} /*普通div,按文档流*/
.a1, .a2, .a3, .a4{position:absolute; width:100px;height:100px;} /*设置绝对定位后


相关文档:

css定位的区别:relative,absolute

首先一点需要知道,
每个浏览器都有自己默认的默认样式,为了让页面内容显示在浏览器中所希望的位置,而不是继承默认样式,就需要在body选择器中重新设定margin和padding的属性值。
如下所示:
body
{
 margin:0;
 border:0;
}
其次,练习时用这个例子:
html内容:
<body >
 
 &nbs ......

css中padding和margin的详细区别

本文将讲述HTML和CSS的关键—盒子模型(Box model). 理解Box model的关键便是margin和padding属性, 而正确理解这两个属性也是学习用css布局的关键.
注: 为什么不翻译margin和padding? 原因一, 在汉语中并没有与之相对应的词语; 原因二: 即使有这样的词语, 由于在编写css代码时, 必须使用margin和padding, 如果我们总用 ......

CSS常见英文单词


 
 
                               A
absolute 绝对的               ......

DIV + CSS 入门

一、什么是DIV+CSS?
“DIV + CSS” 是最新WEB标准的一个典型的应用。
一般来说,网页主要由三部分组成:结构(Structure)、表现(Presentation)和行为(Behavior)等。 结构主要包括例如DIV在内的一系列的HTML(XHTML)标签,表现主要包括CSS(层叠样式表:Cascading Style Sheets), 行为主要包括例如对象模 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号