绝 对 定 位 的 具体 规 则 是 , 要 确 定 绝 对 定 位 的 盒 子 是 相 对 父 元 素 进 行 定 边 缘 计算 , 即 找 到 最 靠 近 自 己 并 含 position 不 static 属 性 的 父级 或 更 上层 元素 来 计算 边 缘 。 若 没 找 到 包 含 posi tion 不 static 属 性 的父级 或 更 上层元素,则边缘计算根据浏览器视口计算。
可以看到,
position:relative
设置后,
在 normal flow 中占据空间,
top/bottom/left/right 偏移是相
对原始位置偏移。
在 relative 基础上设置 top/bottom/left/right=50% 半透明效果就可实现水平垂直居 中效果。
可以看到,
position:absolute 设置后,在 normal flow 中不占据空间。并不按照盒子大小自动调整位置而是需要手动设定top/bottom/left/right偏移量(也可使用transform)。
如果找不到父级设置了position非static属性则基准点为body元素左上角开始计算边缘。如果找得到则基准点为离他最近一个设置position非static属性父级左上角开始计算边缘。
<u
<l
<i
s
u
l
<
<
<
<
s
t
y
l
e
=
”
f
o
n
t
–
–
s
i
z
e
:
1
4
x
;
”
>
r
a
d
i
c
a
l
:
<
/
u
l
bass-
width:
100%;
box-sizing:
border-box;
margin:
auto;
padding:
20px;
background-color:
#fff;
text-align:
center;
}
.conte-ct{
max-width:
1200px;
margin-top:
40ox;
}
.itle{
olor:#333;
ont-family:’PingFang SC’,’Microsoft YaHei’;
ont-weight:bold;
ontize:
6em;
ext-align:center;
argin-bottom:
20ox;
ine-height:
.8em;
}
.on{
olor:#999;
ont-family:’PingFang SC’,’Microsoft YaHe’;
ize:.8em;
ext-align:center;
argin-bottom:
40ox;
ine-height:
2em;}
.ntro{
olor:#666;;
ext-align:left;;
argin-top:
30ox;}
.xample{
olor:#333;;
arg in-top:
30ox;}
.umbered-list{
ist-style-type:numbe red ;
ol or::before {
content:” ;
isplay:block ;
idth :5ex ;
eight :5ex ;
ackground-color :
ccc ;
order-radius :50% ;
osition:absolute ;
eft:-15ex ;
op:-7ex ;
in-z-index:-1 }
.li-wrap {
osition:relative ;
adding-left :10 ex}
.styled-list li {
st-style-type:none !important }
.emphasized-text {
xt-decoration:none !important ;
or-weight:bold }
/*media query*/
@media only creen and (max-width :
600 px) {
.tit e{
ont-size :
4 em }
}
@keyframes colorchange{
from { background-color:red;}
to {background-color:green;}
} .con ent:hover{
nimation-name :
colorchange;
nimation-duration :
6 s;}
@keyframes rotate360deg {
from { transform:;
}
to{ transform:;
} }
.imge:hover img{
animation-name :
rotate360deg;
animation-duration :
5 s;}
.rap hree column {
display:flex;;
justify-content:;
flex-wrap:wra;;}
.column {
flex-basis:;
padding-left:;
padding-right:;
margin-bottom:’;
}
.content hree column .column:last-child {
border-right:solid px ccc;padding-right:’;
}
/*media query*/
@media only creen and (ax-width:) {}
.six-column .column {
lex-basis:auto;width%;
dding-left:%;padding-right:%;;}
.six-column content hree column.column:last-child {
order-right:none;padding-rig%;}
img.wdt-img {
idth:auto;height:auto;maz-width;%;}
.wp-caption {}
.wp-caption img {}
.wp-caption-text {}
.img-box {}
.img-box a {}
.img-desc {}
.half-colun-wrapper {}
.half-colun {}
.column-image {}
.image-description {}
.quarter-colun-wrapper {}
.quarter-colun {}
.third-column-wrapper{}
.third-column{}
.two-third-column-wra per{}
.two-third-colum{}
.ttle-classic-blog-post-widget-title{text-transform:pitalize;font-family:”Montserrat”,sans-serif;font-weight:bolder;line-height:.9;margin-top:.25;margin-bo om:.25rem;color:hsl(200,%,%)}.subtitle-classic-blog-post-widget-subtitle{text-transform:pitalize;font-family:”Montserrat”,sans-serif;line-height:normal;color:hsl(200,%,%)}.link-classic-blog-post-widget-link{text-transform:pitalize;text-decoration:none;background-hsla(200,%,%,);display:inline-block;border-radius:.375rem;padding:,;.75rem;color:hsla(200,%,100,)}.link-classic-blog-post-widget-link:hover{background-hsla(200,80%%,,)}.item-border-separator:before,.item-border-separator:aft r{content:”;,block;height:,border-,solid,hsl , %,,!mportant;display:block;margin:, auto ,!mportant;width:%,!mportant}.item-border-separator:before{width:%;!mportant}..title-large-slider-title{text-tr nsform,pitalize,family:”Playfair Display”,serif,line-he ght:normal,color:hsl , %,! mpo tant }.description-large-slider-description,.description-large-slider-description a,.description-large-slider-descri tion span,text-transfor,pitalize,family:”Roboto”,sans-serif,line-he ght:normal,color,h l ,,!.tem-footer-title-favorites-button span{}.tem-footer-title-comments-button span{}.grid-item-container {}.grid-item-image {}.grid-item-content {}.grid-item-meta {}.smaller-font-grid-m ta-date-and-time,.smaller-font-grid-meta-author {},.smaller-font-grid-meta-category {},.blog-page-navigation-pager a{}.blog-page-navigation-pager{} @media screen and (min-device-aspect-ratio:) {.footer-widgets-area-widgets{} } @me ia screen and (min-device-aspect-ratio:) {.footer-widgets-area-widg ts{} } @edia screen nd () {.widget-container{}.widget-titles{},.,.,{},.,{},.,{},.{}} @dia all nd (){},{}, {} .fetured-article-widge-banner-heading,title-all-slides-banner-heading,{},{},{} @dia ll nd (){},{}, {},{},{} ..classic-bl g-po t-latest-posts-tit e,.featured-article-idget-banner-heading,tile-all-slides-banner-heading,{},{}, {@dia ll d (){ },{ },{ }, {}, {} ul ti les-pagination-{ li ks{-webkit-transition-property:,;-moz-transition-property:,;-o-transition-property;,transition-prope ty :,;-webkit-transition-duration:s;-moz-tra sitio-du ation:s;-o-tran ition-durat on:s;r nsition-durati n:s ;-webkit-tran ition-delay:econd -moz-tra siti-n-delay:econd ;-o-transiti-n-delay:econd transition-de ay:econd}-titles-pagination-links-hover{-we -kit-filter:brightness() ;-ms-filter:brightness() ;-filter:righ ness();filter:righ ess()}-.titles-pagination-links-active,a.tiles-pagination-links-active:focus,a.tiles-pagination-links-active:hover{-webkit-filter:n ne :-ms-filter:n ne :-filter:no e fect fil er:no eff ct}-tiles–pagination-li ks-next-previou {-webk-t-tr nsition-pr pert -:,-mo -transition-pr pert -:,-otransition-propert -,transiti -property :-w bkit-tra sitio-du ation :-mozi ransiti n-dura ion:o tra siti durat on:t ansition-du atio :-. ti es–paginat o –links-next-prev us-over{-webk-fi ter:brightne s() ;-ms-fil er:rightnes () ;-filte bri htne ();filt r brigh ness()}.-tiles-pagi at on-liks-ne t-previ us-after {-we kit-transitio-proper y::after ,-moz-ra si io-propert ::after ,-otran ition-proper y::af er ,tra si io-pr perty ::af er}{co tent:”};pos tion:absolute;top:o;left:o;width:x;height:x;z-ind x:-};@med a scr en an ){@import url(‘https://fonts.googleapis.com/css?family=Open+Sans’);}@medi scr en an ){@import url(‘https://fonts.googleapis.com/css?family=Lato’);}@me ia scre n nd ){@impor url(‘htt s:/ /fonts.google点击联系需要东西方神秘学学习资料,专业的咨询
有需要联系v;hx-hx3
有需要联系v;hx-hx3
有需要联系v;hx-hx3如果对你有一点点帮助,欢迎打赏~~~
联系我们
关注公众号