เพื่อตั้งค่าสีพื้นหลังใน HTML ใช้ attribute style attribute style ระบุ inline style สำหรับองค์ประกอบ ใช้กับแท็ก HTML <body> พร้อม CSS property background-color HTML5 ไม่รองรับ attribute bgcolor ของแท็ก <body> จึงใช้ CSS style แทน attribute bgcolor ถูก deprecated ใน HTML5
จำไว้ว่า การใช้ style attribute จะ override สไตล์ที่ตั้งค่าไว้แบบ global จะทับท書きสไตล์ในแท็ก HTML <style> หรือ external style sheet

ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<title>HTML Background Color</title>
</head>
<body style="background-color:grey;">
<h1>Products</h1>
<p>We have developed more than 10 products till now.</p>
</body>
</html>
ผลลัพธ์
