CSS를 사용하면 요소에 대한 측면 특정 패딩을 설정할 수 있습니다. padding-top, padding-right, padding-bottom 및 padding-right 속성은 각각 위쪽, 오른쪽, 아래쪽 및 왼쪽 패딩을 정의합니다. 패딩 속기 속성을 사용하여 시계 방향으로 값을 지정하여 동일한 출력을 얻을 수도 있습니다.
구문
CSS 패딩 속성의 구문은 다음과 같습니다 -
Selector {
padding-top: /*value*/
padding-right: /*value*/
padding-bottom: /*value*/
padding-left: /*value*/
} 다음 예는 목록 스타일을 보여줍니다 -
예시
<!DOCTYPE html>
<html>
<head>
<style>
article {
margin: 2em 1em;
padding: 3%;
background-color: plum;
letter-spacing: 0.05em;
}
span {
padding: 0 53%;
border-right: dashed;
background-image: linear-gradient(to right, lavenderblush, lightblue);
font-size: 1.4em;
font-style: italic;
}
</style>
</head>
<body>
<h2>What is Xamarin?</h2>
<article>
<span>Xamarin is a software company based in San Francisco. Xamarin is built on the .NET Framework.</span> It provides commercial software development tools that allow a user to develop applications for Android, iOS and Windows using C# language and the .NET framework.
</article>
</body>
</html> 출력

예시
<!DOCTYPE html>
<html>
<head>
<style>
div {
max-width: 400px;
padding-left: 30px;
padding-top: 44px;
padding-bottom: 60px;
background-image: linear-gradient(to bottom, oldlace, lightblue);
border: thin solid;
text-align: center;
}
div > div {
padding-right: 70px;
}
</style>
</head>
<body>
<h2>Swift programming language by Apple</h2>
<div>Swift is a programming language developed by Apple Inc for iOS and OS X development.
<div>Swift 4 uses the same runtime as the existing Obj-C system on Mac OS and iOS, which enables Swift 4 programs to run on many existing iOS 6 and OS X 10.8 platforms.
</div>
</div>
</body>
</html> 출력
