[CSS] background

2020. 4. 7. 10:35·CSS
1. background-color: 색상
2. background-image: url('주소')
3. background-repeat: 값
4. background-size : 값
5. background-position: 값

1 - 배경색
2 - 배경 이미지
3 - 이미지 반복 방법 및 여부
4 - 배경 이미지 크기 조절
5 - 배경 이미지 위치 조절
<template>
  <div class="background">
    background
  </div>
</template>

<script>


export default {
  data(){
    return {
    }
  },
    methods:{

    },

  }

</script>

<style scoped>
 .background{
   border: 3px solid red;
   margin-top: 50px;
   font-size: 100px;
   height: 555px;
   background-color: aqua;
   background-image: url('../assets/pic2.png');
   background-repeat: no-repeat;
   background-size: contain;
 }
</style>

background-repeat

  • no-repeat : 반복 X
  • repeat : x,y축 모두 반복
  • repeat-x : x축만 반복
  • repeat-y : y축만 반복

background-position

  • center: 가운데 위치
  • top: 가운데 상단 위치
  • bottom: 가운데 하단 위치
  • left(top, center, bottom)
  • right(top, center, bottom) 

background-size

  • contain: 화면에 여백을 주고 원본 사진이 모두 나옴
  • cover: 화면에 배경이미지가 가득 차지만 원본 사진은 어느정도 짤림

 

예제)

 

1. 

   background-repeat: no-repeat;
   background-position: center right

2.

   background-repeat: repeat-x;
   background-position: bottom;

3. 

   background-repeat: no-repeat;
   background-size: contain

4.

   background-repeat: no-repeat;
   background-size: cover

 

'CSS' 카테고리의 다른 글

[CSS] transition  (0) 2020.04.07
[CSS] flex  (0) 2020.04.06
[CSS] position  (0) 2020.04.03
[CSS] inline vs block  (0) 2020.03.31
[CSS] 적용 우선순위  (0) 2020.03.31
'CSS' 카테고리의 다른 글
  • [CSS] transition
  • [CSS] flex
  • [CSS] position
  • [CSS] inline vs block
꾸준2
꾸준2
  • 꾸준2
    꾸준2
    꾸준2
  • 전체
    오늘
    어제
    • 분류 전체보기 (157)
      • 복습 프로젝트 (3)
      • 어드민 프로젝트 (4)
      • 프로젝트 리팩토링 (4)
      • Database (0)
      • Java Library (2)
      • Java (4)
      • Java(JVM) (1)
      • 자바 문제 (13)
        • 이론 (6)
        • 실습 (7)
      • IDE (2)
        • IntelliJ (2)
      • 인강 (13)
        • SpringBoot(JPA활용1) (0)
        • 자바(기본편) (6)
        • 자바(중급1편) (3)
        • 자바(중급2편) (1)
        • 자바 ORM 표준 JPA 프로그래밍 - 기본편 (3)
      • Network (2)
      • Node (3)
      • CS (0)
      • amCharts4 (5)
      • 오류 모음 (4)
        • 리눅스 (1)
      • 기타지식 (2)
      • 자주 사용하는 기능 (4)
      • Vue (11)
      • Javascript (13)
      • Javascript-메서드 (3)
      • CSS (6)
      • 라이브러리 (4)
      • 자료구조 (11)
      • 알고리즘 (4)
      • Vue-프로젝트 (20)
      • Vue-bitcoin프로젝트 (6)
      • 블로그클론 프로젝트 (11)
      • 면접 (2)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
꾸준2
[CSS] background
상단으로

티스토리툴바