Colours and backgrounds
หน้านี้ต้องใช้เบราว์เซอร์ล่าสุด (รองรับ SharedArrayBuffer) กรุณาอัปเดต Chrome, Edge, Firefox หรือ Safari เป็นเวอร์ชันล่าสุด
สี
- คุณสามารถ ระบุ สีได้:
red,blue,green,tomato,goldและอื่นๆ อีกมากมาย - หรือใช้ รหัสเฮกซาดzim เช่น
#2a7ae2— ซึ่งเป็น#ตามด้วยตัวเลขเฮกซาดzimหกตัว (0–9และa–f) - ชื่อกีจำง่าย; รหัส hex ให้สีที่แม่นยำนับล้านสี
พื้นหลัง
colorเปลี่ยนสี ข้อความbackground-colorเปลี่ยนสี พื้นหลัง ขององค์ประกอบ- ใส่
background-colorลงในbodyเพื่อทาสีทั้งหน้า
English
<style>
body { background-color: #f3f4f6; }
h1 { color: tomato; }
</style>
<h1>Hello!</h1>
<p>A page with a soft grey background.</p>
ข้อผิดพลาดที่พบบ่อย
colorตั้งค่าข้อความ;background-colorตั้งค่าพื้นหลัง- สีคือชื่อ, รหัส
#rrggbbหรือrgb(...)
ลองดูเลย
colorคือข้อความ;background-colorอยู่ด้านหลัง- ทาสีพื้นหลังหน้าเว็บก่อน แล้วใช้สีแบบ hex กับหัวข้อ
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Give the whole page a soft background. Add body { background-color: lightyellow; }.
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Colour the heading with a hex code. Add h1 { color: #2a7ae2; } (that's a blue).
ความยาก 2/5 · 140 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Colours can be mixed from red, green and blue. Give the heading the colour rgb(0, 128, 0), and the page the background #f0f8ff.