탭 문자의 길이를 설정하고 공백을 추가하려면 tabSize 를 사용하십시오. 재산. Firefox에서 작업하려면 MozTabSize 를 사용하십시오. 속성을 지정하고 탭의 길이를 설정합니다.
예시
JavaScript로 탭 문자의 길이를 반환하기 위해 다음 코드를 실행할 수 있습니다 -
<!DOCTYPE html>
<html>
<body>
<pre id = "t1">
This is demo text
</pre>
<p>Change the tab-size property</p>
<button onclick = "display()"> Update tab-size </button>
<script>
function display() {
// Works in Firefox
document.getElementById("t1").style.MozTabSize = "16";
document.getElementById("t1").style.tabSize = "16";
}
</script>
</body>
</html> 탭 크기 속성 변경