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

กำหนดเงารอบข้อความใน CSS (text-shadow)


คุณสมบัติ text-shadow

ใช้คุณสมบัติ text-shadow เพื่อกำหนดเงารอบข้อความ ลองรันโค้ดต่อไปนี้เพื่อเรียนรู้วิธีกำหนดเงารอบข้อความใน CSS:

ตัวอย่าง

<html>
  <head>
  </head>
  <body>
    <p style="text-shadow:3px 1px 4px green;">
      If your browser supports the CSS text-shadow property, this text will have a green shadow. </p>
  </body>
</html>

รูปแบบค่า:

text-shadow: h-offset v-offset blur-radius color;
  • h-offset - ระยะแนวนอน
  • v-offset - ระยะแนวตั้ง
  • blur-radius - รัศมีการเบลอ
  • color - สีของเงา

สามารถกำหนดเงาหลายชั้นได้ คั่นด้วยจุลภาค