- External CSS : With an external style sheet, you can change the look of an entire website by changing just one file.
- Internal CSS : An internal style sheet may be used if one single HTML page has a unique style. The internal style is defined inside
- Inline CSS : An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.
- CSS comments are not displayed in the browser, but they can help document your source code.
- Comments are ignored by browsers.
- A CSS comment placed inside the <style> element, and start with /* and end with */.
Example :
/* This is a single-line comment */
p { color: red;}
- Colors are specified using predefined color names, or RGB, HEX Values.
- RGB Value : In CSS, a color can be specified as an RGB value, using this
- formula: rgb(red, green, blue)
- Each parameter (red, green, and blue) defines the intensity of the color between 0 and 255.
- For example, rgb(255, 0, 0)
<!DOCTYPE html>
<html lang="en">
<head>
<title>RGB Example</title>
<style>
body {
background-color: rgb(240, 240, 240); /* Light gray background */
}
h1 {
color: rgb(255, 99, 71); /* Tomato red color */
}
p {
color: rgb(50, 150, 50); /* Medium green color */
}
</style>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a paragraph with a medium green color.</p>
</body>
</html>
<!DOCTYPE html>
<html >
<head>
<title>HEX Example</title>
<style>
body {
background-color: #f0f0f0; /* Light gray background */
}
h1 {
color: #ff6347; /* Tomato red color */
}
p {
color: #329932; /* Medium green color */
}
</style>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>This is a paragraph with a medium green color.</p>
</body>
</html>
0 Comments