CSS Basics
Docs MDN Documentation for CSS
Learn A web.dev course on CSS
CSS Fundamentals Mdc Documentation for CSS Fundamentals
Syntax
Selectors
Selectors MDN Documentation for CSS Selectors
<element>
e.gp
a
h1
…id
attribute e.g<p id="paragraphedID"></p>
the id attribute in the example.class
attribute e.g<p class="paragraphedClass"></p>
the class attribute in the example.
Property and Value
There is so many properties and values to choose from. Refer to the link below for a complete list.
CSS Reference Index Browse an alphabetical index of all of the standard CSS properties, pseudo-classes, pseudo-elements, data types, functional notations and at-rules.
The Box Model
The Box Model MDN Documentation for the Box Model
Learn the Box Model A web.dev course on the box model
- Margin: It’s the space between the border of an element and other elements around it;
- Border: It’s the boundary line of an element.
- Padding: It’s the space between the boundary line and the actual content.
- Content: It’s the area that holds the data to be rendered.
Where to write CSS
//TODO: Create Examples for svelte and jsx
Inline
Internal
External
Media Queries
Media queries allow you to apply CSS styles depending on a device’s media type (such as print vs. screen) or other features or characteristics such as screen resolution or orientation, aspect ratio, browser viewport width or height, user preferences such as preferring reduced motion, data usage, or transparency.
Media Queries Docs MDN Documentation for Media Queries
Learn A web.dev course on Media Queries
Media Queries Reference MDN Reference for Media Queries
Rules
Order Matters
CSS reads code from top to bottom.
The !important
Override
Case insensitive
Write your selectors, properties and values in kebab case.
my-custom-class
and not myCustomClass
font-size
and not fontSize