首页前端开发CSScss的绝对定位与相对定位

css的绝对定位与相对定位

时间2024-05-24 14:44:03发布访客分类CSS浏览98
导读:相对定位 父级有代码: .picbox{ position: relative; width: 400px; height: 250px; margin: 0 auto ; 也就是代码中的position: relative;时,子...

相对定位

父级有代码:

.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

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: css的绝对定位与相对定位
本文地址: https://pptw.com/jishu/667095.html
Css居中常用方式 linux挂载点迁移的方法是什么

游客 回复需填写必要信息