Related Topics
Introduction
CSS Page 1
CSS Page 2
CSS Page 3
CSS Page 4
CSS Selectors and the Box Model
CSS Page 5
CSS Page 6
CSS Page 7
CSS Layout and Display Properties
CSS Page 8
CSS Page 9
CSS Page 10
CSS Page 11
CSS Text and Font Properties
CSS Page 12
CSS Page 13
CSS Page 14
CSS Page 15
CSS Backgrounds and Borders
CSS Page 16
CSS Page 17
CSS Page 18
CSS Page 19
CSS Page 20
CSS Colors and Transparency
CSS Page 21
CSS Page 22
CSS Page 23
CSS Page 24
CSS Gradients and Shadows
CSS Page 25
CSS Page 26
CSS Transformations and Animations
CSS Page 27
CSS Page 28
CSS Page 29
CSS Flexbox and Grid Layout
CSS Page 30
CSS Page 31
CSS Page 32
CSS Media Queries and Responsive Design
CSS Page 33
CSS Page 34
CSS Page 35
CSS Transitions and Transforms
CSS Page 36
CSS Page 37
CSS Page 38
CSS Preprocessors (Sass, Less, etc.)
CSS Page 39
CSS Page 40
CSS Page 41
CSS Best Practices and Debugging Techniques.
CSS Page 42
CSS Page 43
CSS Page 44

HTML
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body style="background-color: #f2f2f2;">
<h1>Welcome to my web page</h1>
<p>This is some example text.</p>
</body>
</html>
In the above example, the style
attribute is used to set the background color of the body
element to a light gray color (#f2f2f2
). You can set the background color to any valid CSS color value, such as a named color (red
, green
, blue
, etc.), a hexadecimal color code (#RRGGBB
or #RGB
), or an RGB or RGBA value (rgb(R, G, B)
or rgba(R, G, B, A)
).
Note that you can also specify the background color of specific elements within the page by setting their background-color
style property in CSS. This can be done inline using the style
attribute, or in an external CSS file.
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
<style>
/* CSS style rule for the body element */
body {
color: red; /* Set text color to red */
font-family: Arial; /* Set font family to Arial */
}
</style>
</head>
<body>
<h1>Welcome to my web page</h1>
<p>This is some example text.</p>
</body>
</html>
In the above example, the CSS style rule is applied to the body
element, which sets the text color to red and the font family to Arial. You can apply similar style rules to other HTML elements, such as headings (<h1>
, <h2>
, etc.) and paragraphs (<p>
), by using their element names instead of body
in the CSS selector.




Popular Category
Topics for You
Introduction
CSS Page 1
CSS Page 2
CSS Page 3
CSS Page 4
CSS Selectors and the Box Model
CSS Page 5
CSS Page 6
CSS Page 7
CSS Layout and Display Properties
CSS Page 8
CSS Page 9
CSS Page 10
CSS Page 11
CSS Text and Font Properties
CSS Page 12
CSS Page 13
CSS Page 14
CSS Page 15
CSS Backgrounds and Borders
CSS Page 16
CSS Page 17
CSS Page 18
CSS Page 19
CSS Page 20
CSS Colors and Transparency
CSS Page 21
CSS Page 22
CSS Page 23
CSS Page 24
CSS Gradients and Shadows
CSS Page 25
CSS Page 26
CSS Transformations and Animations
CSS Page 27
CSS Page 28
CSS Page 29
CSS Flexbox and Grid Layout
CSS Page 30
CSS Page 31
CSS Page 32
CSS Media Queries and Responsive Design
CSS Page 33
CSS Page 34
CSS Page 35
CSS Transitions and Transforms
CSS Page 36
CSS Page 37
CSS Page 38
CSS Preprocessors (Sass, Less, etc.)
CSS Page 39
CSS Page 40
CSS Page 41
CSS Best Practices and Debugging Techniques.
CSS Page 42
CSS Page 43
CSS Page 44
Go through our study material. Your Job is awaiting.