본문 바로가기
CSS

css background 속성 단축

by memory-log 2020. 10. 1.

css background 단축 속성 사용하기

body {
  background:
     url(sweettexture.jpg)    /* image */
     top center / 200px 200px /* position / size */
     no-repeat                /* repeat */
     fixed                    /* attachment */
     padding-box              /* origin */
     content-box              /* clip */
     red;                     /* color */
}
background-color: #000;
background-image: url(images/bg.gif);
background-repeat: no-repeat;
background-position: top right;

단축 css

background: #000 url(images/bg.gif) no-repeat top right;

여러 배경 적용하기

.myclass {
  background: background1, background 2, ..., backgroundN;
}
.multi-bg-example {
  width: 100%;
  height: 400px;
  background-image: url(https://mdn.mozillademos.org/files/11305/firefox.png),
      url(https://mdn.mozillademos.org/files/11307/bubbles.png),
      linear-gradient(to right, rgba(30, 75, 115, 1), rgba(255, 255, 255, 0));
  background-repeat: no-repeat,
      no-repeat,
      no-repeat;
  background-position: bottom right,
      left,
      right;
}

'CSS' 카테고리의 다른 글

How to set input placeholder color  (0) 2021.01.07
prevent zooming when the input focus on mobile  (0) 2021.01.07
모바일 시스템 폰트 설정, Mobile System Font  (0) 2020.12.19
CSS 시스템 폰트 System font css  (0) 2020.10.01
CSS variables  (0) 2020.09.21

댓글