개요 스타일을 설정하려면 outlineStyle을 사용하세요. 재산. 윤곽선은 실선, 점선, 파선 등일 수 있습니다.
예시
다음 코드를 실행하여 JavaScript를 사용하여 요소 주위의 윤곽선 스타일을 설정할 수 있습니다 -
<!DOCTYPE html>
<html>
<head>
<style>
#box {
width: 450px;
background-color: orange;
border: 3px solid red;
margin-left: 20px;
}
</style>
</head>
<body>
<p>Click below to add Outline Style.</p>
<div id="box">
<p>This is a div. This is a div. This is a div. This is a div. This is a div.</p>
<p>This is a div. This is a div. This is a div. This is a div. This is a div.</p>
<p>This is a div. This is a div. This is a div. This is a div. This is a div.</p>
</div>
<br>
<button type="button" onclick="display()">Set Outline Style</button>
<br>
<script>
function display() {
document.getElementById("box").style.outlineColor = "#5F5F5F";
document.getElementById("box").style.outlineStyle = "solid";
}
</script>
</body>
</html>