Introduction to CSS
What is CSS?
CSS stands for Cascading Style Sheets. It is a stylesheet language used to control the appearance and presentation of HTML web pages.
CSS allows developers to change the color, size, font, spacing, alignment, borders, backgrounds and layout of HTML elements.
Why Do We Use CSS?
Without CSS, HTML pages would mainly contain plain text, images and other elements without attractive formatting. CSS makes websites more visually appealing and easier to use.
Examples of CSS Properties
Some common CSS properties include:
- color – changes the text color.
- background-color – changes the background color.
- font-size – changes the size of text.
- font-family – specifies the typeface.
- text-align – controls text alignment.
- margin – creates space outside an element.
- padding – creates space inside an element.
- border – adds a border around an element.
CSS Syntax
CSS uses a selector followed by one or more declarations.
color: blue;
font-size: 18px;
}
Types of CSS
There are three main ways of applying CSS to an HTML document:
- Inline CSS – CSS is written directly inside an HTML element.
- Internal CSS – CSS is written inside the
<style>element in the HTML document. - External CSS – CSS is written in a separate
.cssfile.
Conclusion
CSS is an important technology in web development. It works together with HTML to create attractive, organized and user-friendly web pages.