欢迎来到DIVCSS5查找CSS资料与学习DIV CSS布局技术!

 

相对定位

父级有代码:

.picbox{

    position: relative;

    width: 400px;

    height: 250px;

    margin: 0 auto ;

也就是代码中的position: relative;时,子级的定位可以相对父级而决定位子。

 

子级的代码:

 

子级的代码中必须有 position: absolute;这段代码

 

css原码展示:

 

.picbox{

    position: relative;

    width: 400px;

    height: 300px;

    margin: 0 auto;

 

}

.picbox span{

    position: absolute;

    top:10px;

    bottom: 10px;

    color: #f3eded;

}

位子如何定位:

 

top:10px;

bottom: 10px;

由此代码决定他们相对父级的位子

 

Div的透明度:

 

.ttbg{

    position: absolute;

    left: 0;

    bottom: 0%;

    width: 400px;

    height: 40px;

    background: red;

    opacity: 0.1;

css样式中的代码opacity: 0.1;表示颜色的透明度

图片

css3中的表示方法

background:rgba(0,0,0,0.5)

解析

rgb:指的是ps中代码颜色

a:指的是通道的透明度

css绝对定位

代码:

相对于整个网页的定位

position:absolute

绝对定位:相对于父级定位

.picbox{

    position: relative;

    width: 400px;

    height: 300px;

    margin: 0 auto;9

如需转载,请注明文章出处和来源网址:http://www.divcss5.com/rumen/r17982.shtml