การใช้สไตล์ชีต CSS
เปลี่ยนสิ่งนี้:
<link rel="stylesheet" href="">
สำหรับสิ่งนี้:
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
ในการใช้สไตล์ชีต คุณต้องเพิ่มคลาสให้กับองค์ประกอบ HTML ที่คุณต้องการจัดรูปแบบ:
<div class="w3-container w3-black">
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</div>
โครงกระดูก HTML / CSS
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>Page Title</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<style>
</style>
<script src=""></script>
<body>
<img src="img_la.jpg" alt="LA" style="width:100%">
<div class="w3-container w3-black">
<h1>This is a Heading</h1>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</div>
</body>
</html>
คลิกที่ปุ่ม "ลองใช้เอง" เพื่อดูว่ามันทำงานอย่างไร!
ลองเปลี่ยนสีพื้นหลังของคอนเทนเนอร์จากน้านเป็นสีดำ
คุณทำมันได้หรือไม่
ยินดีด้วย!
คุณเพิ่งได้เรียนรู้พื้นฐานของการใช้สไตล์ชีต
อ่านต่อ!
วิธีการตอบสนอง
โค้ด HTML
<div class="w3-row">
<div class="w3-third">
<img src="img_avatar.png" alt="Name1" style="width:100%">
</div>
<div class="w3-third">
<img src="img_avatar.png" alt="Name2" style="width:100%">
</div>
<div class="w3-third">
<img src="img_avatar.png" alt="Name3" style="width:100%">
</div>
</div>
วิธีการสร้างการ์ด
พร้อมสำหรับบางสิ่งที่ล้ำหน้าจริงๆ แล้วหรือยัง?
แล้วนามบัตรใน HTML ล่ะ?
รวมทั้งรูปภาพและข้อความ
Play with the code below for a while, until you think you got a grip on it.
After that, we will start coding really fantastic HTML pages.
John Doe
Engineer
HTML Code
<div class="w3-card" style="width:200px">
<img src="img_avatar.png" style="width:100%">
<div class="w3-container w3-center">
<p class="w3-xlarge">John Doe</p>
<p>Engineer</p>
</div>
</div>