Or how to master CSS using available free content.
Photo by Paula May on Unsplash
CSS is a very vast topic seems to be easy at first, but it becomes a pain in a head when you want to master it not for lack of tutorials but for lack of path or full curriculum to mastering it, here I am going to show you how to master CSS by following a curriculum contain very comprehensive resources from the internet, and sure it will be free.
Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language like HTML. CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript. CSS is designed to enable the separation of presentation and content, including layout, colors, and fonts. This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple web pages to share formatting by specifying the relevant CSS in a separate .css file and reduce complexity and repetition in the structural content. (Source: Wikipedia)
In each section you can find π Contents and π Resources, in contents I show to you what topics included in this section then in resources sections I list some of the big and most comprehensive ( articles, videos or courses ) resources covering this topic. But before you start you need to learn the basics of HTML & CSS then follow the Curriculum to master CSS.
Some section has β it means that this is recommended tools to use.
- html & css is hard - A friendly web development tutorial for complete beginners.
- Learn CSS - An evergreen CSS course and reference to level up your web styling expertise.
- Introduction to HTML - Scrimba.
- Introduction to CSS - Scrimba.
- HTML Crash Course For Absolute Beginners - by Traversy Media on Youtube.
- CSS Crash Course For Absolute Beginners - by Traversy Media on Youtube.
Photo taken from w3schools
A CSS rule-set consists of a selector and a declaration block:
The selector points to the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon. A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces. (Source: w3schools)
In CSS, selectors are used to targeting the HTML elements on our web pages that we want to style.
-
Simple Selectors:
- Element
- Class
- Id
- Universal Selector ( , ns|, |, |* )
-
Combinators & Multiple selectors:
- Group of selector [A, B].
- Descendant selector [A B].
- Child selector [A > B].
- Adjacent sibling selector [A + B].
- General sibling selector [A ~ B].
-
Attribute Selectors
-
Pseudo-class Selectors
-
Pseudo-element Selectors
- π CSS Selectors - MDN web docs.
- π Simple Selectors - MDN web docs.
- π Combinators & Multiple selectors - MDN web docs.
- π Attribute Selectors - MDN web docs.
- π Pseudo-class and Pseudo-element Selectors - MDN web docs.
Note: You will learn more about properties when you get into proper section but you can learn some generic concept like CSS variables.
- CSS Variables
- π Learn CSS Variables Course - Scrimba.
- π CSS Custom Properties Guide - CSS Tricks.
- π Everything you need to know about CSS Variables - Freecodecamp.
CSS values are set against CSS Properties and reside within CSS declaration block, which is a part of the CSS rule/statement. Note: You will learn more about each value type when you get into proper section but you can learn some generic values like rem, colors, calc ...etc.
-
There are 4 types of values in CSS
- Colors.
- Length, sizes and numbers.
- Pre-Defined Options.
- Functions.
-
How CSS values are processed.
- Initial value - MDN web docs.
- Resolved value - MDN web docs.
- Specified value - MDN web docs.
- Computed value - MDN web docs.
- Used value - MDN web docs.
- Actual value - MDN web docs.
- π Color - MDN web docs.
- π A Nerdβs Guide to Color on the Web - CSS Tricks.
- π CSS Gradients Guides - CSS Tricks.
- π A Couple of Use Cases for Calc() - CSS Tricks.
Cascading is the algorithm used for solving conflicts where multiple CSS rules apply to an same HTML element. The cascade algorithm is split into 4 distinct stages.
Position and order of appearance: the order of which your CSS rules appear Specificity: an algorithm which determines which CSS selector has the strongest match Origin: the order of when CSS appears and where it comes from, whether that is a browser style, CSS from a browser extension, or your authored CSS Importance: some CSS rules are weighted more heavily than others, especially with the !important rule type
-
Position and order of appearance:
- Inline style
- Embedded style tag
- External file
-
Specificity hierarchy:
- Universal selector
- Element or pseudo-element selector
- Class, pseudo-class, or attribute selector
- ID selector
- Inline style attribute
- !important rule
-
Origin:
- User agent base styles: Browser style like chrome, firefox, ...etc.
- Local user style: System style like windows, android, ..etc.
- Authored CSS: Any css developer are write
- Authored
!important
: any!important
developer are write
- π The βCβ in CSS: The Cascade - CSS Tricks.
- π Cascading and Inheritance
- πΉ CSS Basics (Part2) β Cascades - by DevTips on Youtube.
- πΉ CSS Basics (Part6) β Specificity - by DevTips on Youtube.
- π inheritance
- π Inherit, initial, unset, revert
Photo taken from w3.org
The CSS box model is the foundation of layout on the Web β each element is represented as a rectangular box, with the box's content, padding, border, and margin built up around one another like the layers of an onion. As a browser renders a web page layout, it works out what styles are applied to the content of each box, how big the surrounding onion layers are, and where the boxes sit in relation to one another. Before understanding how to create CSS layouts, you need to understand the box model. (source: MDN)
- Content (images, textΒ β¦etc).
- Fill Area (the area that contains border, padding, content, and filling with background and background-image).
- Margins (Space around elements, outside of any defined borders).
- Borders (goes around the padding and content ).
- Padding (Transparent area around the content, inside of the box).
- Box Sizing:
- content-box: Width and height only apply to the content of the element.
- border-box: Include padding and border in the element's total width and height.
- Box Shadow:
- Background:
- background-color.
- background-image.
- background-size.
- background-repeat.
- background-position.
- background-origin.
- background-clip.
- background-attachment.
- background-blend-mode.
- Multiple Background Images.
- Linear Gradients.
- Radial Gradients.
- clip-path
- π The box model - MDN web docs.
- π What You Should Know About Collapsing Margins
- π Inline Elements and Block Elements in HTML - Explained
- π Getting Deep Into Shadows
- π Every CSS Background Property Illustrated and Explained with Code Examples ποΈ
After you learn the box-model, learning styling content ( which is the part of box-model ) is the big core concept to master. In this section, you will learn how to style those content like images, text, lists, links ...etc.
- Typography.
- Lists.
- Links.
- Media ( Image, Video, and Audio ).
- Tables.
- Forms.
- Buttons.
- π A Complete Guide to the Table Element - CSS Tricks.
- π Styling Links - MDN web docs.
Once you have the ability to target HTML elements for styling, the layout is the next core concept to master. Layout involves manipulating how elements layout on the page, How much space do they take? Are they side by side or on top of each other?...etc.
- Normal flow
- The display property:
- Block.
- Inline.
- Inline-Block.
- Flexbox.
- Grid.
- Table.
- Floats
- Positioning
- Default ( no property specified or Static ).
- Relative.
- Absoulte.
- Fixed.
- Sticky.
- Stacking Content ( Z-Index property ).
- Multiple-column layout
-
π Learn CSS Layout
-
π Centering in CSS: A Complete Guide - CSS Tricks.
-
Flexbox
- π©βπ» Flexbox Patterns
- π©βπ» Solved by Flexbox
- π CSS flexbox Course - by WesBos.
- π Flexbox Complete Guide - CSS Tricks.
- π The Complete CSS Flex Tutorial
- π Flexbox - The Ultimate CSS Flex Cheatsheet (with animated diagrams!) - Freecodecamp.
- π The Ultimate Guide to Flexboxβ β Learning Through Examples - Freecodecamp.
- π Understanding Flexbox: Everything you need to know - Freecodecamp.
-
Grid
- π©βπ» Grid by Example
- π CSS Grid Course - by WesBos.
- π CSS Grid Complete Guide - CSS Tricks.
- π The Complete CSS Grid Tutorial
- π How to create an image gallery with CSS Grid - Freecodecamp.
-
Floats
- π All About Floats - CSS Tricks.
- πΉ CSS Floats Explained - by DevTips on Youtube.
- πΉ CSS Floats and Clears Explained - by DevTips on Youtube.
-
Positioning
- πΉ CSS Positioning - part1 - by DevTips on Youtube.
- πΉ CSS Positioning - part2 - by DevTips on Youtube.
-
Multiple-column layout
- π When And How To Use CSS Multi-Column Layout - Smashing Magazine.
Responsive Web Design is about using HTML and CSS to automatically resize, hide, shrink, or enlarge, a website, to make it look good on all devices desktops, tablets, and phones. (Source: w3schools)
-
Media Queries
-
Responsive Images
-
- Mostly Fluid.
- Column Drop.
- Layout Shifter.
- Off Canvas.
-
Responsive Layout Methods:
- Mobile-First.
- Desktop-First.
- π Responsive Images
- π Responsive Web Design Fundamentals
- π Introduction To Responsive Web Design - HTML & CSS Tutorial
- π Learn CSS Media Queries by Building Three Projects
- π Learn CSS Flexbox by Building 5 Responsive Layouts
CSS Animations involves manipulating how elements should look like over the time by allowing you to specify how elements change from one style to another.
-
CSS Animations - Transforms:
- Transform translate().
- Transform rotate() and Transform-Origin.
- Transform scale().
- Transform skew().
- Transform Shorthand.
-
CSS Animations - Transitions:
- Transition Duration.
- Transition Property.
- Transition Timing Function.
- Transition Delay.
- Transition Shorthand.
-
CSS Animations - Keyframes:
- CSS Animation Keyframes.
- CSS Animation Duration.
- CSS Animation Fil Mode.
- CSS Animation Iteration Count.
- CSS Animation Delay.
- CSS Animation Direction.
- CSS Animation Timing Function.
- CSS Animation Properties.
- CSS Animation Shorthand.
-
CSS Shapes:
- CSS Shapes: the inset() function.
- CSS Shapes: The circle() Function.
- CSS Shapes: The ellipse() Function.
- CSS Shapes: The polygon() function.
- CSS Shapes: Shapes from the Alpha Channel.
- CSS Shapes: Shapes from the Reference Box.
- π An Introduction to Web Animations - Freecodecamp.
- π A Simple CSS Animation Tutorial - Freecodecamp.
- π CSS Animation Performance
In this area, you can pick up any framework you want, but I will list here the most famous one.
- Tailwind CSS β
- Bootstrap β
- Bulma
-
- π Learn Bootstrap 4 Course - Scrimba.
- π Bootstrap 4: Everything You Need to Know - Freecodecamp.
- π Bootstrap FrameworkβββBest Practices
-
- π learn Bulma Course - Scrimba.
- π Bulma Crash Course - by Traversy Media on Youtube.
If you're not careful, it is easy to write complex, confusing, and unmaintainable CSS. so there are many ways to manage that.
- π BEM For Beginners: Why You Need BEM - Smashing Magazine.
The use of CSS preprocessors has become so important especially when you start working on a large project. Learn about the most famous and common used preprocessor ( SASS ), Why I use it?, How to use it? and How to writing maintainable and scalable Sass.
- Common Preprocessors:
- SASS. β
- LESS.
- Stylus.
- PostCSS. β
- π Learn Sass In 15 Minutes | Tutorialzine
- π SASS Tutorial - by The Net Ninja on Youtube.
- πΉ Sass Workflow & Dev Server From Scratch Using Gulp - by Traversy Media on Youtube.
- π Sass Guidelines
- π How to structure a Sass project
- π PostCSS β A Comprehensive Introduction - Smashing Magazine.
In general, I found this blogs, newsletter or courses the best resources to learn CSS in specific and web development in general and for those who prefer paid courses I list for you the best-paid courses available on the web.
-
References π
-
Courses & Books π π
-
Blogs π, Podcast π, Newsletter π« & Conferences π’
- CSS Tricks π
- Smashing Magazine π
- THe CSS Podcast π