background-repeat
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
CSS background-repeat ìì±ì ë°°ê²½ ì´ë¯¸ì§ì ë°ë³µ ë°©ë²ì ì§ì í©ëë¤. ê°ë¡ì¶ ë° ì¸ë¡ì¶ì ë°ë¼ ë°ë³µí ì ìê³ , ìì ë°ë³µíì§ ìì ìë ììµëë¤.
ìëí´ ë³´ê¸°
background-repeat: repeat-x;
background-repeat: repeat;
background-repeat: space;
background-repeat: round;
background-repeat: no-repeat;
background-repeat: space repeat;
<section id="default-example">
<div id="example-element"></div>
</section>
#example-element {
background: #ccc url("/shared-assets/images/examples/moon.jpg") center / 120px;
min-width: 100%;
min-height: 100%;
}
ë°ë³µí ì´ë¯¸ì§ë 기본ê°ìì ìì í¬ê¸°ì ë°ë¼ ì릴 ì ìì§ë§, ìë¦¬ì§ ìëë¡ ë°°ê²½ ì´ë¯¸ì§ í¬ê¸°ë¥¼ ì¡°ì íê±°ë(round) ëìì ëê¹ì§ ê³ ë¥´ê² ë¶ë°°(space)í ì ììµëë¤.
구문
/* í¤ìë ê° */
background-repeat: repeat-x;
background-repeat: repeat-y;
background-repeat: repeat;
background-repeat: space;
background-repeat: round;
background-repeat: no-repeat;
/* 2ê° ê° êµ¬ë¬¸: ê°ë¡ | ì¸ë¡ */
background-repeat: repeat space;
background-repeat: repeat repeat;
background-repeat: round space;
background-repeat: no-repeat round;
/* ì ì ê° */
background-repeat: inherit;
background-repeat: initial;
background-repeat: unset;
ê°
<repeat-style>-
í ê° ê° êµ¬ë¬¸ì ë ê° ê° êµ¬ë¬¸ì ë¨ì¶ ííì ëë¤.
í ê° ê° ë ê° ê° repeat-xrepeat no-repeatrepeat-yno-repeat repeatrepeatrepeat repeatspacespace spaceroundround roundno-repeatno-repeat no-repeatë ê° ê° êµ¬ë¬¸ì ì쪽ì ê°ë¡ ë°ë³µ ë°©ë²ì, ë¤ìª½ì ì¸ë¡ ë°ë³µ ë°©ë²ì ì¤ì í©ëë¤. ê° ë°©ë²ì ëì ë°©ìì ìë íì ê°ìµëë¤.
repeatììì ë°°ê²½ ììì ì±ì¸ ëê¹ì§ ì´ë¯¸ì§ë¥¼ ë°ë³µí©ëë¤. ë§ì§ë§ ë°ë³µ ì´ë¯¸ì§ê° ëì¹ ê²½ì° ìë¼ë ëë¤. spaceììê° ìë¦¬ì§ ìì ë§í¼ ì´ë¯¸ì§ë¥¼ ë°ë³µí©ëë¤. ì ì¼ ì²ìê³¼ ë§ì§ë§ ë°ë³µ ì´ë¯¸ì§ë ììì ì쪽 ëì ê³ ì ëê³ , ê° ì´ë¯¸ì§ ì¬ì´ì ë¨ì ì¬ë°±ì ê³ ë¥´ê² ë¶ë°°í©ëë¤. ìë¦¬ì§ ìê³ ë°°ì¹í ì ìë ì´ë¯¸ì§ê° ë¨ í ì¥ì¸ ê²½ì°ê° ìëë¼ë©´ background-positionìì±ì 무ìí©ëë¤.space를 ì¬ì©íëë° ì´ë¯¸ì§ê° ì리ë ê²½ì°ë ê·¸ í¬ê¸°ê° ë무 커ì í ì¥ ì¡°ì°¨ ë£ì ì ìë ê²½ì°ë¿ì ëë¤.roundê°ì© ììì´ ëì´ëë©´ ë°ë³µ ì´ë¯¸ì§ë ëì´ë ì¬ë°±ì ë¨ê¸°ì§ ììµëë¤. ì´ë¯¸ì§ë¥¼ íë ë ì¶ê°í ê³µê°ì´ ì기면 (ë¨ì ê³µê° >= ì´ë¯¸ì§ ëë¹ì ì ë°) ë¹ë¡ì ë°ë³µ íì를 íë ì¶ê°í©ëë¤. ì´ ë, ìë ì¡´ì¬íë ì´ë¯¸ì§ë 모ë ì¤ì´ë¤ì´ ìë¡ì´ ì´ë¯¸ì§ë¥¼ ìí ê³µê°ì íë³´í©ëë¤. ìì: ìë ëë¹ê° 260pxì´ê³ , ì¸ ë² ë°ë³µë ì´ë¯¸ì§ë ê°ì 300px ëë¹ê° ë ëê¹ì§ ëì´ë ì ììµëë¤. ê·¸ íìë ì´ë¯¸ì§ë¥¼ ì¶ê°íê³ , ê°ì 225pxë¡ ì¤ì´ëëë¤. no-repeatì´ë¯¸ì§ë¥¼ ë°ë³µíì§ ììµëë¤. ë°ë¼ì ë°°ê²½ ì´ë¯¸ì§ ììì´ ë¤ ì°¨ì§ ìì ì ììµëë¤. ë°ë³µíì§ ìì ì´ë¯¸ì§ì ìì¹ë background-positionCSSìì±ì´ ì¤ì í©ëë¤.
íì ì ì
| ì´ê¸°ê° | repeat |
|---|---|
| ì ì©ëì | all elements. It also applies to ::first-letter and ::first-line. |
| ìì | no |
| ê³ì° ê° | a list, each item consisting of two keywords, one per dimension |
| Animation type | discrete |
íì 구문
background-repeat =
<repeat-style>#
<repeat-style> =
repeat-x |
repeat-y |
repeat-block |
repeat-inline |
<repetition>{1,2}
<repetition> =
repeat |
space |
round |
no-repeat
ìì
>HTML
<ol>
<li>
no-repeat
<div class="one"></div>
</li>
<li>
repeat
<div class="two"></div>
</li>
<li>
repeat-x
<div class="three"></div>
</li>
<li>
repeat-y
<div class="four"></div>
</li>
<li>
space
<div class="five"></div>
</li>
<li>
round
<div class="six"></div>
</li>
<li>
repeat-x, repeat-y (multiple images)
<div class="seven"></div>
</li>
</ol>
CSS
/* Shared for all DIVS in example */
ol,
li {
margin: 0;
padding: 0;
}
li {
margin-bottom: 12px;
}
div {
background-image: url(star-solid.gif);
width: 160px;
height: 70px;
}
/* Background repeats */
.one {
background-repeat: no-repeat;
}
.two {
background-repeat: repeat;
}
.three {
background-repeat: repeat-x;
}
.four {
background-repeat: repeat-y;
}
.five {
background-repeat: space;
}
.six {
background-repeat: round;
}
/* Multiple images */
.seven {
background-image:
url(star-solid.gif), url(/shared-assets/images/examples/favicon32.png);
background-repeat: repeat-x, repeat-y;
height: 144px;
}
ê²°ê³¼
ëª ì¸
| Specification |
|---|
| CSS Backgrounds and Borders Module Level 3 > # background-repeat > |