CSS Introduction
CSS tutorial helps you to understand the CSS style sheet language for beginners, as well as professionals.
CSS tutorial explained with simple programs.
Each topic explained with a simple diagram for better understanding.
What is CSS?
CSS stands for Cascading Style Sheets. It is a style sheet language that controls the presentation of an HTML document. CSS enables developers to separate content from presentation.
Few benefits of CSS
- It saves time by being able to control the layout of many pages simultaneously.
- It improves the website’s performance and makes it more readable.
- It enables the development of responsive and flexible design.
CSS Syntax
selector { property: value; }
- Selector: Specifies the HTML element you want to style.
- Property: The style attribute you want to change (e.g., color, font-size).
- Value: The setting you apply to the property (e.g., red, 16px).
Example
<!DOCTYPE html> <html> <head> <style> body { background-color: #e0f7fa; font-family: 'Segoe UI', sans-serif; } h1 { color: #00796b; } p { font-size: 18px; color: #555; } </style> </head> <body> <h1>Welcome to CSS!</h1> <p>This is a basic example of how CSS styles an HTML page.</p> </body> </html>
Common CSS Properties
Property | Description | Example |
---|---|---|
color | Sets text color | color: red; |
background | Sets background color/image | background: yellow; |
font-size | Sets the size of the font | font-size: 16px; |
margin | Sets space outside an element | margin: 20px; |
padding | Sets space inside an element | padding: 10px; |
border | Sets border around elements | border: 1px solid; |
text-align | Aligns text | text-align: center; |
Quickly Find What You Are Looking For
OnlineTpoint is a website that is meant to offer basic knowledge, practice and learning materials. Though all the examples have been tested and verified, we cannot ensure the correctness or completeness of all the information on our website. All contents published on this website are subject to copyright and are owned by OnlineTpoint. By using this website, you agree that you have read and understood our Terms of Use, Cookie Policy and Privacy Policy.