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

กำหนดว่าเนื้อหาที่ล้นซึ่งไม่ได้แสดงนั้นส่งสัญญาณไปยังผู้ใช้ด้วย CSS . อย่างไร


คุณสมบัติ text-overflow ใช้เพื่อกำหนดว่าเนื้อหาที่ล้นที่ไม่ได้แสดงนั้นส่งสัญญาณไปยังผู้ใช้ด้วย CSS อย่างไร

ตัวอย่าง

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้คุณสมบัติ text-overflow ใน CSS:

<html>
   <head>
      <style>
         p.text1 {
            white-space: nowrap;
            width: 200px;
            border: 1px solid #000000;
            overflow: hidden;
            text-overflow: clip;
         }
         p.text2 {
            white-space: nowrap;
            width: 200px;
            border: 1px solid #000000;
            overflow: hidden;
            text-overflow: ellipsis;
         }
      </style>
   </head>
   <body>
      <b>Original Text:</b>
      <p>Tutorials Point originated from the idea that there exists a class of
      readers who respond better to online content and prefer to learn new skills at
      their own pace from the comforts of their drawing rooms.</p>
      <b>Text overflow:clip:</b>
     
      <p class = "text1">Tutorials Point originated from the idea that there exists
      a class of readers who respond better to online content and prefer to learn
      new skills at their own pace from the comforts of their drawing rooms.</p>
      <b>Text overflow:ellipsis</b>
     
      <p class = "text2">Tutorials Point originated from the idea that there exists
      a class of readers who respond better to online content and prefer to learn
      new skills at their own pace from the comforts of their drawing rooms.</p>
   </body>
</html>

ผลลัพธ์

กำหนดว่าเนื้อหาที่ล้นซึ่งไม่ได้แสดงนั้นส่งสัญญาณไปยังผู้ใช้ด้วย CSS . อย่างไร