Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

ปิดการขึ้นบรรทัดใหม่อัตโนมัติด้วย CSS white-space


เพื่อปิดการขึ้นบรรทัดใหม่อัตโนมัติ (text wrapping) ภายในองค์ประกอบ ให้ใช้คุณสมบัติ white-space ลองรันโค้ดด้านล่างเพื่อใช้งาน white-space property:

ตัวอย่าง

<!DOCTYPE html>
<html>
  <head>
    <style>
      p {
        white-space: nowrap;
      }
    </style>
  </head>
  <body>
    <p>
      This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text. This is demo text.
    </p>
  </body>
</html>