Add some style · เพิ่มสไตล์บางอย่าง
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · หน้านี้ต้องใช้เบราว์เซอร์ล่าสุด (รองรับ SharedArrayBuffer) กรุณาอัปเดต Chrome, Edge, Firefox หรือ Safari เป็นเวอร์ชันล่าสุด
Adding style
- HTML gives your page its content. CSS makes it look good.
- The easiest way to add CSS is a
<style>block near the top of your page. - Inside it, you write rules that change how things look.
A CSS rule
- A rule has three parts:
p { color: blue; } pis the selector — which tags to change (here, every paragraph).coloris the property — what to change.blueis the value — what to change it to. (Together,color: blue;is one declaration.)
<style>
p { color: blue; }
</style>
<p>Now I am blue.</p>
<p>So am I!</p>
Common mistakes
- Link the CSS file, or put rules inside a
<style>block. - Each CSS rule ends with a semicolon
;.
Now you try
- Write your rules inside the
<style>block. - Colour your paragraphs, then your heading.
Make every paragraph blue. Inside the <style> block, add the rule p { color: blue; }. · ทำให้ย่อหน้าทั้งหมดเป็นสี น้ำเงิน ภายในบล็อก <style> เพิ่มกฎ p { color: blue; }
Now colour the heading too. Add a rule h1 { color: red; }. · ตอนนี้เปลี่ยนสีหัวเรื่องด้วย เพิ่มกฎ h1 { color: red; }