place-items
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.
CSS ì place-items ë¨ì¶ ìì± ì 그리ë í¹ì íë ì¤ë°ì¤ ê°ì ê´ê³í ë ì´ìì ìì¤í
ìì ë¸ë¡ ë°©í¥ê³¼ ì¸ë¼ì¸ ë°©í¥ìì (ì를 ë¤ì´, align-items ì justify-items ìì±) íë²ì ììë¤ì ì ë ¬í©ëë¤. ë§ì¼ ëë²ì§¸ ê°ì´ ì§ì ëì§ ìëë¤ë©´, 첫ë²ì§¸ ê°ì´ ëë²ì§¸ ê°ì¼ë¡ë ì¬ì©ë©ëë¤.
ìëí´ ë³´ê¸°
place-items: center stretch;
place-items: center start;
place-items: start end;
place-items: end center;
<section class="default-example" id="default-example">
<div class="example-container">
<div class="transition-all" id="example-element">
<div>One</div>
<div>Two</div>
<div>Three</div>
</div>
</div>
</section>
#example-element {
border: 1px solid #c5c5c5;
display: grid;
grid-template-columns: 1fr 1fr;
grid-auto-rows: 80px;
grid-gap: 10px;
width: 220px;
}
#example-element > div {
background-color: rgba(0, 0, 255, 0.2);
border: 3px solid blue;
}
êµ¬ì± ìì±
ì´ ìì±ì ë¤ì CSSì ë¨ì¶íì ëë¤.
구문
/* ìì¹ ì ë ¬ */
place-items: center;
place-items: normal start;
place-items: center normal;
place-items: start legacy;
place-items: end normal;
place-items: self-start legacy;
place-items: self-end normal;
place-items: flex-start legacy;
place-items: flex-end normal;
/* 기ì¤ì ì ë ¬ */
place-items: baseline normal;
place-items: first baseline legacy;
place-items: last baseline normal;
place-items: stretch legacy;
/* ì ì ê° */
place-items: inherit;
place-items: initial;
place-items: revert;
place-items: revert-layer;
place-items: unset;
ê°
ìë íí ì¤ íëì ê°ì ì·¨í©ëë¤.
- ë¸ë¡ ë°©í¥ê³¼ ì¸ë¼ì¸ ë°©í¥ ëª¨ë를 ì¤ì í기 ìí ì ë ¬ ë¨ì¼
align-itemsê°. - ë¸ë¡ ë°©í¥ì ì ë ¬ì ì¤ì í기 ìí
align-itemsê°, ì¸ë¼ì¸ ë°©í¥ì ì ë ¬ì ì¤ì í기 ìíjustify-itemsê°.
íì ì ì
| ì´ê¸°ê° | as each of the properties of the shorthand:
|
|---|---|
| ì ì©ëì | all elements |
| ìì | no |
| ê³ì° ê° | as each of the properties of the shorthand:
|
| Animation type | discrete |
íì 구문
place-items =
<'align-items'> <'justify-items'>?
<align-items> =
normal |
stretch |
<baseline-position> |
<overflow-position>? <self-position>
<justify-items> =
normal |
stretch |
<baseline-position> |
<overflow-position>? [ <self-position> | left | right ] |
legacy |
legacy && [ left | right | center ]
<baseline-position> =
[ first | last ]? &&
baseline
<overflow-position> =
unsafe |
safe
<self-position> =
center |
start |
end |
self-start |
self-end |
flex-start |
flex-end
ìì
>íë ì¤ ì»¨í ì´ëì ìì ë°°ì¹í기
íë ì¤ë°ì¤ììë ì£¼ì¶ ììê° íëì 그룹ì¼ë¡ ì·¨ê¸ë기 ë문ì justify-self í¹ì justify-items ê° ì ì©ëì§ ììµëë¤. ë°ë¼ì ëë²ì§¸ ê°ì 무ìë©ëë¤.
CSS
#container {
height: 200px;
width: 240px;
place-items: stretch; /* 리ì¤í¸ì ìë ë¤ë¥¸ ìµì
ì ì ííì¬ ê°ì ë³ê²½í ì ììµëë¤. */
background-color: #8c8c8c;
display: flex;
}
ê²°ê³¼
그리ë 컨í ì´ëì ìì ë°°ì¹í기
ë¤ì 그리ë 컨í
ì´ëë ììë¤ì´ ë°°ì¹ë 그리ë ììë³´ë¤ ì기 ë문ì place-items ë ììë¤ì ë¸ë¡ê³¼ ì¸ë¼ì¸ ì°¨ììì ììë¤ì ì´ëìíµëë¤.
CSS
#gridcontainer {
height: 200px;
width: 240px;
place-items: stretch; /* 리ì¤í¸ì ìë ë¤ë¥¸ ìµì
ì ì ííì¬ ê°ì ë³ê²½í ì ììµëë¤. */
background-color: #8c8c8c;
display: grid;
grid-template-columns: repeat(3, 1fr);
}
#gridcontainer > div {
width: 50px;
}
ê²°ê³¼
ëª ì¸ì
| Specification |
|---|
| CSS Box Alignment Module Level 3 > # place-items-property > |
ë¸ë¼ì°ì í¸íì±
ê°ì´ 보기
- CSS íë ì¤ë°ì¤ ê°ì´ë: Basic Concepts of Flexbox
- CSS íë ì¤ë°ì¤ ê°ì´ë: Aligning items in a flex container
- CSS 그리ë ê°ì´ë: Box alignment in CSS Grid layouts
- CSS Box Alignment
align-itemsìì±align-selfìì±justify-itemsìì±justify-selfìì±