텍스트에서 탭, 줄 바꿈 및 공백을 지정하려면 공백 을 사용하십시오. JavaScript의 속성. normal, nowrap, pre 등의 값을 설정합니다. pre를 설정하면
<!DOCTYPE html>
<html>
<head>
<style>
#box {
width: 300px;
height: 100px;
border: 2px solid black;
background-color: gray;
}
</style>
</head>
<body>
<button onclick="display()">Set</button>
<div id="box">
This is Demo Text.
This is Demo Text.
This is Demo Text.
This is Demo Text.
This is Demo Text.
</div>
<script>
function display() {
document.getElementById("box").style.whiteSpace = "pre";
}
</script>
</body>
</html>