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

กำหนดสี สไตล์ และความกว้างขอบในคุณสมบัติเดียวด้วย CSS (border shorthand)


คุณสมบัติ border (Shorthand)

คุณสมบัติ border ให้คุณระบุสี สไตล์ และความกว้างของขอบในคุณสมบัติเดียว

ตัวอย่าง

ลองรันโค้ดต่อไปนี้เพื่อระบุ border property:

<html>
  <head>
  </head>
  <body>
    <p style="border:3px solid green;">
      This example is showing shorthand property for border. </p>
  </body>
</html>

รูปแบบ:

border: <width> <style> <color>;
  • width: thin, medium, thick, หรือความยาว
  • style: none, solid, dotted, dashed, double, groove, ridge, inset, outset, hidden
  • color: สีขอบ
  • ลำดับไม่สำคัญ แต่แนะนำ width style color