HTML DOM 스타일 listStyleImage 속성은 이미지를 목록 항목 마커로 설정하거나 반환하는 데 사용됩니다.
다음은 −
의 구문입니다.listStyleImage 속성 설정 -
object.style.listStyleImage = "none|url|initial|inherit"
위의 속성은 다음과 같이 설명됩니다 -
| 값 | 설명 |
|---|---|
| 없음 | 기본값이며 이미지를 표시하지 않습니다. |
| URL | 이미지 경로 지정. |
| 초기 | 이 속성을 초기 값으로 초기화합니다. |
| 상속 | 상위 속성 값 상속 |
listStyleImage 속성의 예를 살펴보겠습니다. -
예시
<!DOCTYPE html>
<html>
<head>
<script>
function changeListImage() {
document.getElementById("LIST1").style.listStyleImage = "url('https://upload.wikimedia.org/wikipedia/commons/thumb/0/05/Red_circle.svg/10px- Red_circle.svg.png')";
document.getElementById("Sample").innerHTML=" The list marker has been replaced by a red circle image";
}
</script>
</head>
<body>
<ul id="LIST1">
<li>LIST ITEM1</li>
<li>LIST ITEM2</li>
<li>LIST ITEM3</li>
<li>LIST ITEM4</li>
</ul>
<p>Click the below button to set the list style image for the above list</p>
<button type="button" onclick="changeListImage()">Change List Image</button>
<p id="Sample"></p>
</body>
</html> 출력

"목록 이미지 변경을 클릭하면 " 버튼 -
