ในการตั้งค่าการเยื้อง ให้ใช้ textIndent ทรัพย์สิน
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อส่งคืนการเยื้องของข้อความบรรทัดแรกด้วย JavaScript -
<!DOCTYPE html>
<html>
<body>
<div id = "myText">
This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.
</div>
<br>
<button onclick = "display()">Set Text Indent</button>
<script>
function display() {
document.getElementById("myText").style.textIndent = "50px";
}
</script>
</body>
</html>