Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CSS Basics Explained

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

CSS Basics Explained

CSS basic in small words

CSS (Cascading Style Sheets) is used to style HTML elements on a web page. It controls layout, colors,
fonts, and spacing. Here are the basics:

Selectors

Select elements to style:


`h1 { color: red; }` styles all `<h1>` tags.

Properties and Values

Define styles with property-value pairs:


`color: blue;` changes text color.
`font-size: 16px;` sets text size.

Box Model

Content, padding, border, margin:


These define spacing and layout around elements.

Example

css

div {
background-color: lightblue;
padding: 10px;
margin: 5px;
}

Types of CSS

1. Inline: Inside an HTML tag.


`<p style="color: red;">Text</p>`
2. Internal: Inside `<style>` tags in HTML.
3. External: In a `.css` file linked to HTML.

Let me know if you want to dive deeper!

Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 1/1

You might also like