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

이미지를 목록 마커로 사용하는 CSS에서


CSS list-style-image 속성은 이미지를 목록 항목의 마커로 설정하는 데 사용됩니다.

구문

CSS list-style-image 속성의 구문은 다음과 같습니다 -

Selector {
   list-style-image: /*value*/
}

예시

다음 예는 CSS list-style-image 속성을 보여줍니다 -

<!DOCTYPE html>
<html>
<head>
<style>
ul {
   width: 150px;
   list-style-image: url("https://www.tutorialspoint.com/images/Servlets.png");
   background: goldenrod;
}
li {
   text-align: center;
   background: lavenderblush;
   margin: 5px 30px;
}
</style>
</head>
<body>
<h2>Servlets</h2>
<ul>
<li>Client Request</li>
<li>Server Response</li>
<li>Cookies Handling</li>
<li>Session Tracking</li>
</ul>
</body>
</html>

출력

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

이미지를 목록 마커로 사용하는 CSS에서

예시

<!DOCTYPE html>
<html>
<head>
<style>
ul {
   margin-left: 20px;
   list-style-image: url("https://www.tutorialspoint.com/images/hibernate.png");
}
li {
   font-size: 1.3em;
   text-align: center;
   background: burlywood;
   margin: 3px;
}
</style>
</head>
<body>
<h2>Hibernate Tutorial</h2>
<ul>
<li>Sessions</li>
<li>Persistent Class</li>
<li>Mapping Files</li>
<li>Mapping Types</li>
<li>Annotations</li>
</ul>
</body>
</html>

출력

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

이미지를 목록 마커로 사용하는 CSS에서