What is CSS?
CSS stands for Cascading Style Sheets. It is the language used to style and layout web pages. While HTML is used to structure the content of a webpage, CSS is what makes it look attractive by controlling colors, fonts, spacing, and layouts.
Why is CSS Important?
- Consistency: Apply the same styles across multiple pages.
- Design Flexibility: Easily customize the look and feel of a website.
- Separation of Concerns: Keeps design (CSS) separate from content (HTML).
CSS Example
Here is an example of how CSS can change the look of an HTML element:
HTMLcopy
<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Example</title>
<style>
h1 {
color: blue;
text-align: center;
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Hello, CSS!</h1>
</body>
</html>
In this example, the <h1>
tag is styled to have blue text, centered alignment, and a specific font.