আমরা ব্যাকগ্রাউন্ড-কালার বৈশিষ্ট্য ব্যবহার করে একটি উপাদানের পটভূমির রঙ নির্দিষ্ট করতে পারি। আমরা স্ট্যান্ডার্ড নাম, rgb(), rgba(), hsl() বা hsla() দ্বারা মান নির্দিষ্ট করতে পারি।
সিনট্যাক্স
CSS ব্যাকগ্রাউন্ড-কালার প্রপার্টির সিনট্যাক্স নিম্নরূপ -
Selector {
background-color: /*value*/
} উদাহরণ
নিম্নলিখিত উদাহরণগুলি CSS ব্যাকগ্রাউন্ড-কালার প্রপার্টি −
চিত্রিত করে<!DOCTYPE html>
<html>
<head>
<style>
p:first-of-type {
font-family: cursive;
background-color: pink;
}
p:last-child {
background-color: azure;
}
div {
margin: auto;
padding: 5px;
font-family: Helvetica;
width: 430px;
background-color: burlywood;
}
</style>
</head>
<body>
<p>
Java is a high-level programming language originally developed by Sun Microsystems.<p>
<div>
Java released in 1995</div>
<p>
Java runs on a variety of platforms such as Windows, Mac OS, and the various versions of UNIX.</p>
</body>
</html> আউটপুট
এটি নিম্নলিখিত আউটপুট দেয়

উদাহরণ
<!DOCTYPE html>
<html>
<head>
<style>
div {
background-color: springgreen;
}
h1 {
background-color: lightcoral;
text-align: center;
}
p {
background-color: lightseagreen;
font-size: 150%;
}
</style>
</head>
<body>
<div>
<h1>Demo</h1>
<p>This is demo text1. This is demo text2. This is demo text3. </p>
</div>
</body>
</html> আউটপুট
এটি নিম্নলিখিত আউটপুট দেয় -
