css3 전체 크기 배경 이미지 정보
CSS css3 전체 크기 배경 이미지본문
css3 전체 크기 배경 이미지
이제 우리는 항상 전체 브라우저 창을 커버하는 웹 사이트에 배경 이미지를 갖고 싶습니다.
요구 사항은 다음과 같습니다.
1. 전체 페이지를 이미지로 채 웁니다 (공백 없음).
2. 필요에 따라 이미지 크기 조정
3. 페이지 중앙 이미지
4.스크롤 막대를 발생시키지 마십시오.
다음 예제에서는이를 수행하는 방법을 보여줍니다.
html 요소를 사용하십시오 (html 요소는 항상 적어도 브라우저 창의 높이입니다).
그런 다음 고정 된 가운데 놓인 배경을 설정하십시오.
그런 다음 background-size 속성을 사용하여 크기를 조정합니다.
예
html {
background: url(img_flower.jpg) no-repeat center fixed;
background-size: cover;
}
전체소스
<!DOCTYPE html>
<html>
<head>
<style>
html {
background: url(img_flower.jpg) no-repeat center fixed;
background-size: cover;
}
body {
color: white;
}
</style>
</head>
<body>
<h1>Full Page Background Image</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</body>
</html>
0
댓글 0개