Computer >> 컴퓨터 >  >> 프로그램 작성 >> CSS

CSS의 배경 속기 속성


CSS 배경 속기 속성은 요소의 배경을 정의하는 데 사용됩니다. background-color, background-image, background-repeat, background-position, background-clip, background-size, background-origin 및 background-attachment는 함께 CSS 배경 속성을 구성합니다.

구문

CSS 배경 속성의 구문은 다음과 같습니다 -

Selector {
   background: /*value*/
}

예시

다음 예는 CSS 배경 속성을 보여줍니다 -

<!DOCTYPE html>
<html>
<head>
<style>
body {
   background: linen url("https://www.tutorialspoint.com/images/library-sub-banner.jpg") no-repeat 40% 20%;
}
div {
   padding: 100px;
   background: rgba(50,100,50,0.4)url("https://www.tutorialspoint.com/green/images/logo.png") no-repeat left;
}
</style>
</head>
<body>
<h2>Learn</h2>
<ul>
<li>Java</li>
<li>C#</li>
<li>Android</li>
<li>iOS</li>
<li>C++</li>
<li>C</li>
</ul>
<div></div>
</body>
</html>

출력

이것은 다음과 같은 출력을 제공합니다 -

CSS의 배경 속기 속성

예시

<!DOCTYPE html>
<html>
<head>
<style>
table, tr,td{
   margin: auto;
   border: 2px solid red;
   padding: 40px;
}
td {
   background: rgba(50,100,50,0.4)url("https://www.tutorialspoint.com/images/blockchain.png") no-repeat;
}
#demo {
   background: rgba(50,100,50,0.4)url("https://www.tutorialspoint.com/images/reactjs.png") no-repeat;
}
table {
   background: ivory url("https://www.tutorialspoint.com/images/library-sub-banner.jpg") no-repeat center;
}
</style>
</head>
<body>
<h2>Learning is fun</h2>
<table>
<tr><td></td></tr>
<tr><td id="demo"></td></tr>
</table>
</body>
</html>

출력

이것은 다음과 같은 출력을 제공합니다 -

CSS의 배경 속기 속성