HTML DOM borderRadius 속성은 요소의 네 면에 둥근 모서리를 추가하는 데 사용됩니다. 이 속성을 사용하여 borderTopLeftRadius, borderTopRightRadius, borderBottomRightRadius, borderBottomLeftRadius와 같은 테두리 반경 속성을 설정하고 가져올 수 있습니다.
다음은 −
의 구문입니다.borderRadius 속성 설정:
object.style.borderRadius = "1-4 length|% / 1-4 length|%|initial|inherit"
속성 값은 다음과 같이 설명됩니다 -
| 값 | 설명 |
|---|---|
| 길이 | 테두리 모양을 정의합니다. |
| % | 백분율로 테두리 모양을 정의합니다. |
| 초기 | 이 속성을 초기 값으로 설정합니다. |
| 상속 | 상위 속성 값을 상속하려면 |
borderRadius 속성의 예를 살펴보겠습니다 -
예시
<!DOCTYPE html>
<html>
<head>
<style>
#DIV1{
height: 100px;
width: 200px;
border: 10px groove orange;
padding: 10px;
border-radius: 1px 1px 1px 1px;
}
</style>
<script>
function changeBorderRadius(){
document.getElementById("DIV1").style.borderRadius="45px 45px 45px 45px";
document.getElementById("Sample").innerHTML="The border radius for the four borders of the above div are now increased";
}
</script>
</head>
<body>
<div id="DIV1">SOME SAMPLE TEXT</div>
<p>Increase the above div border radius size by clicking the below button</p>
<button onclick="changeBorderRadius()">Change Border Radius</button>
<p id="Sample"></p>
</body>
</html> 출력

"테두리 반경 변경" 버튼을 클릭하면 -
