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

ทำการคำนวณเพื่อกำหนดค่าคุณสมบัติ CSS


รับค่าคุณสมบัติใน CSS โดยใช้คุณสมบัติ calc() คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้ฟังก์ชัน calc() ใน CSS

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         #demo {
            position: absolute;
            width: calc(100% - 100px);
            background-color: blue;
            text-align: center;
         }
      </style>
   </head>
   <body>
      <h1>Heading One</h1>
      <div id = "demo">This is it!</div>
   </body>
</html>