inset-block-start
åºçº¿
广æ³å¯ç¨
*
èª 2021å¹´4æ èµ·ï¼æ¤ç¹æ§å·²å¨ä¸»æµæµè§å¨ä¸å¾å°æ¯æï¼å¯å¨å¤§å¤æ°è®¾å¤åæµè§å¨çæ¬ä¸æ£å¸¸ä½¿ç¨ã
* æ¤ç¹æ§çæäºé¨åçæ¯æç¨åº¦å¯è½ææä¸åã
CSS 屿§ inset-block-start å®ä¹äºå
ç´ çåé¦åç§»ï¼å¹¶æ ¹æ®å
ç´ ç书忍¡å¼ãè¡å
æ¹ååææ¬æå对åºè³å®ä½åç§»ãæ ¹æ® writing-modeãdirection å text-orientation æå®ä¹çå¼ï¼æ¤å±æ§å¯¹åºäº topãrightãbottom æ left 屿§ã
å°è¯ä¸ä¸
writing-mode: horizontal-tb;
writing-mode: vertical-rl;
writing-mode: horizontal-tb;
direction: rtl;
writing-mode: vertical-lr;
<section id="default-example">
<div class="example-container" id="example-element">
<div id="abspos">
I am absolutely positioned with inset-block-start: 50px
</div>
<p>
As much mud in the streets as if the waters had but newly retired from the
face of the earth, and it would not be wonderful to meet a Megalosaurus,
forty feet long or so, waddling like an elephantine lizard up Holborn
Hill.
</p>
</div>
</section>
#example-element {
border: 0.75em solid;
padding: 0.75em;
position: relative;
width: 100%;
min-height: 200px;
unicode-bidi: bidi-override;
}
#abspos {
background-color: yellow;
color: black;
border: 3px solid red;
position: absolute;
inset-block-start: 50px;
inline-size: 140px;
}
è¯æ³
css
/* é¿åº¦å¼ */
inset-block-start: 3px;
inset-block-start: 2.4em;
/* å
å«åç宽度æé«åº¦çç¾åæ¯ */
inset-block-start: 10%;
/* å
³é®è¯å¼ */
inset-block-start: auto;
/* å
¨å±å¼ */
inset-block-start: inherit;
inset-block-start: initial;
inset-block-start: revert;
inset-block-start: revert-layer;
inset-block-start: unset;
åå¼
inset-block-start 屿§çåå¼ä¸ left 屿§ç¸åã
å½¢å¼å®ä¹
| åå§å¼ | auto |
|---|---|
| éç¨å ç´ | positioned elements |
| æ¯å¦æ¯ç»§æ¿å±æ§ | å¦ |
| Percentages | logical-height of containing block |
| 计ç®å¼ | same as box offsets: top, right, bottom, left properties except that directions are logical |
| å¨ç»ç±»å | a length, percentage or calc(); |
å½¢å¼è¯æ³
inset-block-start =
auto |
<length-percentage>
<length-percentage> =
<length> |
<percentage>
示ä¾
>设置åé¦åç§»
HTML
html
<div>
<p class="exampleText">ç¤ºä¾ææ¬</p>
</div>
CSS
css
div {
background-color: yellow;
width: 120px;
height: 120px;
}
.exampleText {
writing-mode: vertical-lr;
position: relative;
inset-block-start: 20px;
background-color: #c8c800;
}
ç»æ
è§è
| è§è |
|---|
| CSS Logical Properties and Values Module Level 1> # propdef-inset-block-start> |
| CSS Positioned Layout Module Level 3> # propdef-inset-block-start> |
æµè§å¨å ¼å®¹æ§
åè§
- å®ä¹å
¶ä»åç§»ç屿§ï¼
inset-block-endãinset-inline-startåinset-inline-end - 对åºçå®ä½å±æ§ï¼
topãrightãbottomåleft writing-modeãdirectionãtext-orientation