place-self
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2020ë 1ì.
* Some parts of this feature may have varying levels of support.
place-self CSS ë¨ì¶ ìì± ì 그리ë í¹ì íë ì¤ë°ì¤ ì ê°ì ê´ê³í ë ì´ìì ìì¤í
ìì ë¸ë¡ ë°©í¥ê³¼ ì¸ë¼ì¸ ë°©í¥ìì íë²ì ê°ë³ ìì를 ì ë ¬í©ëë¤ (ìì. align-items ì justify-items ìì±). ë§ì¼ ëë²ì§¸ ê°ì´ ì§ì ëì§ ìëë¤ë©´, 첫ë²ì§¸ ê°ì´ ëë²ì§¸ ê°ì¼ë¡ë ì¬ì©ë©ëë¤.
ìëí´ ë³´ê¸°
place-self: stretch center;
place-self: center start;
place-self: start end;
place-self: end center;
<section class="default-example" id="default-example">
<div class="example-container">
<div class="transition-all" id="example-element">One</div>
<div>Two</div>
<div>Three</div>
</div>
</section>
.example-container {
border: 1px solid #c5c5c5;
display: grid;
width: 220px;
grid-template-columns: 1fr 1fr;
grid-auto-rows: 80px;
grid-gap: 10px;
}
.example-container > div {
background-color: rgba(0, 0, 255, 0.2);
border: 3px solid blue;
}
êµ¬ì± ìì±
ì´ ìì±ì ë¤ì CSSì ë¨ì¶íì ëë¤.
구문
/* í¤ìë ê° */
place-self: auto center;
place-self: normal start;
/* ìì¹ ì ë ¬ */
place-self: center normal;
place-self: start auto;
place-self: end normal;
place-self: self-start auto;
place-self: self-end normal;
place-self: flex-start auto;
place-self: flex-end normal;
/* 기ì¤ì ì ë ¬ */
place-self: baseline normal;
place-self: first baseline auto;
place-self: last baseline normal;
place-self: stretch auto;
/* ì ì ê° */
place-self: inherit;
place-self: initial;
place-self: revert;
place-self: revert-layer;
place-self: unset;
ê°
auto-
ë¶ëª¨ ìì±ì
align-itemsê°ì¼ë¡ ê³ì°ë©ëë¤. normal-
ì´ í¤ìëì í¨ê³¼ë ì°ë¦¬ê° ë§ë ë ì´ìì 모ëì ë°ë¼ ë¬ë¼ì§ëë¤.
- ì ë ìì¹ë¡ ì§ì ë ë ì´ììì ê²½ì°, ì´ í¤ìëë ëì²´ë ì ë ìì¹ ë°ì¤ìì
startì²ë¼ ëìíê³ , ë¤ë¥¸ 모ë ì ë ìì¹ ë°ì¤ììëstretchì²ë¼ ëìí©ëë¤. - íë ì¤ ììë¤ìì, ì´ í¤ìëë
stretchì²ë¼ ëìí©ëë¤. - 그리ë ììë¤ìì, ì´ í¤ìëë
stretchì ë¹ì·í ëìì íì§ë§, aspect ratio ë°ì¤ íí í¹ì ê³ ì í í¬ê¸°ë¥¼ ê°ì§ ë°ì¤ììëstartì²ë¼ ëìí©ëë¤. - ì´ ìì±ì ë¸ë¡ ë 벨ì ë°ì¤ë í ì ì ì ì©ëì§ ììµëë¤.
- ì ë ìì¹ë¡ ì§ì ë ë ì´ììì ê²½ì°, ì´ í¤ìëë ëì²´ë ì ë ìì¹ ë°ì¤ìì
self-start-
ìì를 êµì°¨ ì¶ì ìì ì§ì ì í´ë¹íë ì ë ¬ 컨í ì´ëì ê°ì¥ì리ì ë§ê² ì ë ¬í©ëë¤.
self-end-
ìì를 êµì°¨ ì¶ì ë ì§ì ì í´ë¹íë ì ë ¬ 컨í ì´ëì ê°ì¥ì리ì ë§ê² ì ë ¬í©ëë¤.
flex-start-
íë ì¤ ììì êµì°¨ ìì ë§ì§ ê°ì¥ìë¦¬ê° ì ì êµì°¨ ìì ê°ì¥ì리ì ë§ë¿ìµëë¤.
flex-end-
íë ì¤ ììì êµì°¨ ë ë§ì§ ê°ì¥ìë¦¬ê° ì ì êµì°¨ ë ê°ì¥ì리ì ë§ë¿ìµëë¤.
center-
íë ì¤ ììì ë§ì§ ë°ì¤ê° êµì°¨ ì¶ì ì ì¤ìì ìì¹í©ëë¤. ë§ì¼ ììì êµì°¨ í¬ê¸°ê° íë ì¤ ì»¨í ì´ëë³´ë¤ í° ê²½ì°, ììë ì쪽 ë°©í¥ì¼ë¡ ê· ë±íê² ë칩ëë¤.
baseline,first baseline.last baseline-
첫ë²ì§¸ í¹ì ë§ì§ë§ 기ì¤ì ì ë ¬ì ì°¸ì¬ë¥¼ ì§ì í©ëë¤. ë°ì¤ì 첫ë²ì§¸ í¹ì ë§ì§ë§ 기ì¤ì ì¸í¸ì ì ë ¬ 기ì¤ì ì í´ë¹ 기ì¤ì ì ê³µì íë 그룹ì 모ë ë°ì¤ì ê³µì 첫ë²ì§¸ í¹ì ë§ì§ë§ 기ì¤ì ì¸í¸ì ìë 기ì¤ì ê³¼ ë§ì¶ì´ ì ë ¬í©ëë¤.
first baselineì ëì²´ ì ë ¬ìstartì´ë©°,last baselineì ëì²´ ì ë ¬ìendì ëë¤. stretch-
êµì°¨ ì¶ì ë°ë¼ ê²°í©ë ììë¤ì í¬ê¸°ê° ì ë ¬ 컨í ì´ëë³´ë¤ ìê³ í¬ê¸°ê°
autoë¡ ì§ì ë ê²½ì°, í´ë¹ ììì í¬ê¸°ë ëì¼íê² (ë¹ë¡íì§ ìê²) ì¦ê°íë ë°ë©´,max-height/max-width(í¹ì ëë±í 기ë¥)ì ìí´ ë°ìíë ì ì½ë¤ì ì¤ìíì¬ ëª¨ëautoí¬ê¸°ì ììë¤ì ê²°í©ë í¬ê¸°ê° êµì°¨ ì¶ì ë°ë¼ ì ë ¬ 컨í ì´ë를 ì íí ì±ìëë¤.
íì ì ì
| ì´ê¸°ê° | as each of the properties of the shorthand:
|
|---|---|
| ì ì©ëì | block-level boxes, absolutely-positioned boxes, and grid items |
| ìì | no |
| ê³ì° ê° | as each of the properties of the shorthand:
|
| Animation type | discrete |
íì 구문
place-self =
<'align-self'> <'justify-self'>?
<align-self> =
auto |
<overflow-position>? [ normal | <self-position> ] |
stretch |
<baseline-position> |
anchor-center
<justify-self> =
auto |
<overflow-position>? [ normal | <self-position> | left | right ] |
stretch |
<baseline-position> |
anchor-center
<overflow-position> =
unsafe |
safe
<self-position> =
center |
start |
end |
self-start |
self-end |
flex-start |
flex-end
<baseline-position> =
[ first | last ]? &&
baseline
ìì
>ê°ë¨í ìì°í´ë³´ê¸°
ë¤ìì 2 x 2 그리ë ë ì´ìì ìì ì
ëë¤. ì´ê¸°ì 그리ë 컨í
ì´ëì justify-items ì align-itemsë 기본 ê°ì¸ stretch ë¡ ì¤ì ëì´ ìì´ ê·¸ë¦¬ë ììê° í´ë¹ ì
ì ì ì²´ ëë¹ë§í¼ ëì´ë©ëë¤.
ëë²ì§¸, ì¸ë²ì§¸, ê·¸ë¦¬ê³ ë¤ë²ì§¸ 그리ë ììë 기본 ê°ê¸° ë¤ë¥¸ place-self ê°ì ë¶ì¬íì¬, ì´ë¬í ê°ë¤ì´ 기본 ë°°ì¹ë¥¼ ì´ë»ê² ì¬ì ìíëì§ë¥¼ ëíë
ëë¤. ì´ ê°ë¤ì 그리ë ììê° ì½í
ì¸ ì ëë¹/ëì´ì ë§ì¶ì´ ëë¹/ëì´ë¥¼ ì¡°ì íê³ , ë¸ë¡ ë°©í¥ê³¼ ì¸ë¼ì¸ ë°©í¥ìì ì
ë´ ë¤ë¥¸ ìì¹ì ì ë ¬ë ì ìëë¡ í©ëë¤.
HTML
<article class="container">
<span>첫ë²ì§¸</span>
<span>ëë²ì§¸</span>
<span>ì¸ë²ì¨°</span>
<span>ë¤ë²ì§¸</span>
</article>
CSS
html {
font-family: helvetica, arial, sans-serif;
letter-spacing: 1px;
}
article {
background-color: red;
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-rows: 80px;
grid-gap: 10px;
margin: 20px;
width: 300px;
}
span:nth-child(2) {
place-self: start center;
}
span:nth-child(3) {
place-self: center start;
}
span:nth-child(4) {
place-self: end;
}
article span {
background-color: black;
color: white;
margin: 1px;
text-align: center;
}
article,
span {
padding: 10px;
border-radius: 7px;
}
ê²°ê³¼
ëª ì¸ì
| Specification |
|---|
| CSS Box Alignment Module Level 3 > # place-self-property > |
ë¸ë¼ì°ì í¸íì±
ê°ì´ 보기
- CSS íë ì¤ë°ì¤ ê°ì´ë: íë ì¤ë°ì¤ì 기본 ê°ë
- CSS íë ì¤ë°ì¤ ê°ì´ë: íë ì¤ ì»¨í ì´ëììì ìì ì ë ¬
- CSS 그리ë ê°ì´ë: CSS 그리ë ë ì´ìì ììì ë°ì¤ ì ë ¬
- CSS ë°ì¤ ì ë ¬
align-selfìì±justify-selfìì±