728x90
속성값
background 속성값은 아래에서 파란색으로 표시된 부분을 참조해서 적습니다.
background-color, 배경 색깔 지정
: 16진수(#ff0000), 색 이름(red), rgb 값 rgb(255,0,0) 중에서 선택
예) body{background: green;}
background-image 배경 이미지 주소 지정
: url('rabbit.png');
예) body{background: url('brabbit.png');}
background-repeat 배경 이미지 패턴 지정
: repeat 기본값, repeat-x 가로 반복, repeat-y 세로 반복 no-repeat 반복되지 않음
예) body{background: repeat-x;}
background-attachment 배경 이미지 고정 방식
: scroll 기본값 fixed, local 중 선택
예) body{background: fixed;}
background-position 배경 위치 지정
: left right center (가로) top center bottom(세로), % , cm,px, em 등에서 선택
예) body{background: left center;}
background-size 배경 이미지 크기 지정
: auto, px, %, cover, contain 중에서 선택
예) body{background:100px 100px;}
상속 여부 : no
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
body{
/*
background-color: red;
background-image: url("back.jpg");
background-repeat: no-repeat;
background-position: right top;
*/
background: #00ff00
url("back.jpg")
no-repeat
right top;
}
</style>
</head>
<body>
</body>
</html>

728x90
'HTML' 카테고리의 다른 글
33일차//[css] 📕과제 1 // 화면분활, padding , margin (0) | 2021.02.26 |
---|---|
32일차//[css] HTML A tag //링크의 글자색(font color on text link)을 지정하는 방법 (0) | 2021.02.25 |
city 예제 <div>를 사용하여 영역나누기 External 방식 (0) | 2021.02.25 |
32일차//border, <div id = " ">, <style> (0) | 2021.02.25 |
32일차//[css] css 기초 [단위] (0) | 2021.02.25 |