Complete Css
Complete Css
Series
A complete journey from beginner to pro in CSS.
Master foundational styles, advanced techniques, and
pro-level design skills to create polished, responsive
websites
Basic Advanc Pro level
ed Beginner Projects
1. Introduction to CSS 1.CSS3 Visual Effects
2. CSS Selectors • Profile Card
2 .CSS Pseudo Classes & Elements
3. CSS Syntax & Comments • Photography Gallery
3. CSS Combinators
4. Colors & Backgrounds • Responsive Navbar
4.CSS Layout Techniques
5. Units & Dimensions • Newsletter Signup Form
5. CSS Transitions, Transformations, and
6. Fonts & Text Properties Intermediate Projects
Animations
7. The CSS Box Model • Personal Portfolio Website
6. CSS Inheritance
8. CSS Display & Positioning • Parallax scrolling
7. Media Queries & Responsive Design
9. CSS Overflow • Clock design
8. CSS BEM & SMACSS
10. CSS Debugging • Personal style
9. CSS Variables (Custom Properties)
11. CSS Resets Advanced Projects
10. Custom Scrollbars
12. Understanding Specificity • Responsive course ui
11. CSS Shapes and Clip Paths
• Restaurant Menu Page
12 CSS for Print Media
• Hotels
1: Introduction to CSS
What is CSS?
Youtube: softcamper
Types of CSS (Inline, Internal, External)
•Inline CSS – Quick styling for a single element
•Internal CSS – Styling for a single HTML page
•External CSS – Styles multiple pages with one stylesheet
Youtube: softcamper
How to Link CSS in HTML
Inline CSS: CSS inside an HTML tag using style
attribute
Youtube: softcamper
2: CSS Selectors
Youtube: softcamper
Types of Selectors
Element Selector: Targets all instances of an HTML element
Youtube: softcamper
Grouping Selectors
Attribute Selectors
Child Selectors
Youtube: softcamper
3:Adding Comments in CSS
Comments are used to explain code or disable sections for testing.
They don't affect the code and help with readability
Youtube: softcamper
4. Colors & Backgrounds
4.1. Colors in CSS
Youtube: softcamper
2. RGB Colors: RGB stands for Red, Green, and Blue. Each
color is defined by a value between 0 and 255, representing the
intensity of the respective color.
Examples:
px – Pixels
cm / mm – Centimeters / Millimeters (used for print)
in – Inches (rare in web design)
Box takes up 100% of screen width and height (ideal for hero
sections).
5.6 : Width and Height Best Practices
Fixed sizes (px): Use for icons or buttons that need precise
dimensions.
Fluid sizes (%): Use for grids or containers that need to scale.
Viewport units (vh/vw): Use for fullscreen elements.
Font sizes (em/rem): Use rem for consistent typography and
em for local scaling.
Summary Table
6: Fonts & Text Properties
Typography plays a key role in user experience (UX) and
design consistency.
CSS offers a variety of text properties to ensure your content is
readable, visually appealing, and aligned with the brand
identity.
6.1 font-family
defines the typeface for the text.
It accepts a comma-separated list of fonts to provide fallback options.
Fonts can be serif, sans-serif, monospace, or custom web fonts.
•1.5rem: Scales with the root font size (16px × 1.5 = 24px).
•Using rem ensures text scales uniformly with user preferences.
Import: Load the Roboto font with 400 (regular) and 700 (bold) weights.
Fallback: sans-serif is used if Roboto fails to load.
📌 Best Practice: Use the display=swap parameter to ensure the text remains visible during
font loading.
Summary Table
7:CSS Box Model
The CSS Box Model defines how every HTML element is structured and how it
interacts with other elements in terms of space and layout.
•Each element is a box that consists of content, padding, border, and margin.
Anatomy of the Box Model
Content: The actual content inside the box (e.g., text, image).
Padding: The space between the content and the border.
Border: The edge that wraps around the padding (optional).
Margin: The space outside the border, separating the element from other elements.
Visual Representation of Box Model
7.1 Content, Padding, Border, and Margin in Detail
1.Content
This is the core part where text, images, or other elements
appear.
Example:
2: Padding
Adds space inside the element between the content and the
border.
The background color extends into the padding area.
Position Values:
1.static (default)
•The element follows the normal document flow.
2.relative
•Positioned relative to its normal position. You can shift it using top, left, right, or bottom.
3.absolute
•Positioned relative to the nearest non-static parent.
4.fixed
•Positioned relative to the viewport. Stays in place during scrolling.
5.sticky
•Sticks to a position until the scroll threshold is reached.
8.4 CSS Floats & Clearfix
• Elements with a higher z-index appear on top of those with a lower one.
•The overflowing content is clipped (hidden), and no scrollbars are provided to access the hidden
content.
The element will have scrollbars, even if the content does not
overflow.
overflow: auto
Scrollbars appear only if the content overflows.
If the content fits within the element, no scrollbars are shown.
<div style="width: 200px; height: 100px; overflow: auto; box-sizing: border-box; padding: 20px;
border: 1px solid black;"> Content inside with padding and scrollable overflow. </div>
Summary of Overflow Properties
10: CSS Debugging
CSS debugging ensures your styles are applied correctly and
helps identify layout, spacing, or display issues. The most
effective tool for CSS debugging is Browser Developer
Tools.
their effect.
1. Radial Gradients
•Colors radiate outward from a central point, creating a circular or
elliptical gradient.
•Syntax: radial-gradient(shape size, color1, color2, ...)
CSS3 Shadows
Text Shadow
Adds shadows to text for depth or glow effects.
Syntax: text-shadow: h-offset v-offset blur-radius color;
Box Shadow
Adds shadows to boxes (such as divs or images).
Syntax: box-shadow: x-offset ,y-offset, blur-radius and color;
CSS3 Filters
Filters add effects like blurring or color changes to elements, particularly images.
1.Blur: Makes an element appear soft and out of focus.
•Syntax: filter: blur(px);
•Example: filter: blur(4px);
2.Grayscale: Converts an element to shades of gray.
•Syntax: filter: grayscale(percentage);
•Example: filter: grayscale(100%);
3.Sepia: Adds a warm, brown tint for a vintage effect.
•Syntax: filter: sepia(percentage);
•Example: filter: sepia(70%);
4.Other Filters:
•Brightness, Contrast, Invert: Adjusts the color intensity, contrast, or inversion
2: CSS Pseudo Classes & Elements
CSS pseudo-classes and pseudo-elements allow you to style elements based on their state
or specific portions of content, creating interactive and visually engaging designs without
extra HTML markup.
CSS Pseudo-Classes
Pseudo-classes apply styles to an element based on its state
or position in the DOM.
1. Styles an element when the user hovers over it
with a mouse.
2. Example: Change button color on hover.
Styles an element when it is focused (e.g., a form input selected by the user).
Example: Add a border to focused input fields
(n)
Targets elements based on their order in a parent container, where n can be any number or
pattern (e.g., even or odd).
Example: Alternate row colors in a table .
Applies styles to the first child element within a parent.
::after
Inserts content after the selected element, commonly used to
add decorative elements.
Example: Add a clearfix to ensure an element contains
floated child elements
Combining Pseudo-Classes and Pseudo-Elements
You can combine pseudo-classes and pseudo-elements to create more
complex styling scenarios.
Example:
• Highlight the first paragraph in a container on hover.
3:CSS Combinators
CSS combinators are used to define the relationships between elements, allowing us to
target elements more precisely based on their hierarchy or position relative to each other.
The main combinators include descendant, child, adjacent sibling, and general sibling
Descendant Combinator ( )
The descendant combinator targets any element inside another, regardless of nesting depth.
•Syntax: selectorA selectorB
•Targets all elements matching selectorB that are inside any selectorA.
Explanation: Selects all <p> elements inside any <div>, regardless of how deeply nested they are.
Child Combinator ( > )
The child combinator targets direct children only, excluding deeper descendants.
•Syntax: selectorA > selectorB
•Applies styles only to elements matching selectorB that are immediate children of selectorA.
Explanation: Selects <li> elements that are direct children of a <ul>, ignoring any nested <li>
elements within those children.
Adjacent Sibling Combinator ( + )
The adjacent sibling combinator selects the element immediately following a specified element.
•Syntax: selectorA + selectorB
•Targets the first selectorB element that appears directly after selectorA.
Explanation: Selects the first <p> element directly following an <h1> element, applying a margin
only to that immediate sibling.
General Sibling Combinator ( ~ )
The general sibling combinator selects all elements that are siblings of a specified element,
regardless of position.
•Syntax: selectorA ~ selectorB
•Targets all selectorB elements that are siblings of selectorA within the same parent.
Explanation: Selects all <p> elements that are siblings of an <h1> within the same parent
container.
4: CSS Layout Techniques
CSS Flexbox
•Basics: One-dimensional layout method for arranging items in a row or
column.
•Alignment: Flexbox offers powerful alignment options (e.g., justify-
content, align-items, align-self) for precise control of spacing and
positioning.
•Wrapping: Controls whether items should wrap onto multiple lines
(flex-wrap) when space is insufficient.
•Order: Allows reordering of elements with the order property, without
changing the HTML structure.
CSS Grid
Tracks: Define rows and columns using grid-template-rows and grid-template-columns.
Auto-Placement: Automatically places items within the grid; useful for layouts where content size is
variable.
Areas: Enables naming grid areas, allowing precise control over where content should be placed.
Nesting: Grids can be nested within other grids, offering flexibility for complex layouts.
Multi-Column Layout
Designed for creating newspaper-like column layouts.
Uses properties like column-count, column-gap, and column-width to control the number and width
of columns.
Best for text-heavy content that can be split across multiple columns for improved readability.
5: CSS Transitions, Transformations, and
Animations
1.CSS Transitions
Used to create smooth transitions between property changes.
Duration: Controls the length of the transition (e.g., transition-duration: 0.3s).
Timing Functions: Defines the speed curve, such as ease, linear, ease-in, and ease-out.
Delays: Allows you to delay the start of a transition (e.g., transition-delay: 0.2s).
CSS Transforms
Rotate: Rotates an element (e.g., transform: rotate(45deg);).
Scale: Changes the size of an element (transform: scale(1.2);).
Skew: Tilts an element (e.g., transform: skew(20deg);).
Translate: Moves an element from its original position (e.g., transform: translate(50px, 0);).
CSS Keyframe Animations
Allows creating more complex animations that are not tied to user actions.
margin
padding
border
background
width
height
7: Media Queries & Responsive Design
Media queries and responsive design techniques allow websites to adapt to different
screen sizes and devices, ensuring a smooth and accessible experience for all users.
Media Queries Syntax and Usage
Media queries let you apply CSS styles based on the characteristics of the
user’s device, like screen size, resolution, orientation, etc.
Syntax:
Common Conditions:
min-width and max-width: Often used to create responsive breakpoints.
orientation: Checks if the device is in landscape or portrait mode.
resolution: Applies styles based on screen resolution (useful for high-resolution displays).
Breakpoints and Responsive Layouts
• Breakpoints: Specific screen widths where
layout changes should occur to fit various devices
(e.g., mobile, tablet, desktop).
• Common Breakpoints:
• Mobile: 320px - 480px
• Tablet: 768px - 1024px
• Desktop: 1024px and above
• Responsive Layout: Adjusts layout, spacing, and
content to fit the screen size, typically by stacking
elements vertically on smaller screens or
changing font sizes and paddings for readability.
Mobile-First Design Philosophy
•Mobile-First Approach: Start by designing for the
smallest screen size and then add styles for larger
screens.
•Benefits:
•Ensures the core functionality and content are
optimized for mobile users.
•Encourages lightweight, performant design, as
smaller screens are generally less powerful.
•Implementation:
•Define base styles for mobile devices and use
min-width media queries to enhance layouts for
larger screens.
8: CSS BEM & SMACSS
• BEM and SMACSS are CSS methodologies that help
developers write modular, reusable, and maintainable
styles for scalable applications. Each offers a
structured approach to organizing CSS, reducing
specificity issues, and enhancing readability.
Explanation:
•button: The main block component.
•button--primary: A modified version of the button block.
•button__icon: An element within the button block.
•button__icon--small: A modified version of the button__icon element
Benefits of BEM:
Clear, consistent naming convention that reflects component structure.
Reduced CSS specificity issues since the structure encourages low
specificity selectors.
Easy to read and understand, making it maintainable across teams.
Scalable and Modular Architecture for CSS
(SMACSS)
• SMACSS, developed by Jonathan Snook, is a
methodology for organizing CSS based on
design patterns rather than UI components. It
emphasizes scalability and modularity,
especially in large projects.
SMACSS Categories:
Base: Contains default styles for HTML
elements (e.g., resets, typography).
Layout: Defines the major structural
components (e.g., header, footer, grid).
Module: Styles for individual reusable
components (e.g., buttons, cards).
State: Defines styles that describe the UI
state (e.g., hidden, active).
Theme: Contains styles for themes or
specific visual adjustments
9:CSS Variables (Custom Properties)
CSS Variables, also known as custom properties, allow you to define reusable
values in CSS, making it easier to manage and update styles, especially in larger
projects.
Syntax:
Creating and Using CSS Variables
•CSS variables are defined using the -- prefix and are
scoped to the selector they are defined on, often set in
the :root to make them globally accessible.
Explanation:
•This example sets the scrollbar width and height
to 10px.
•The scrollbar track has a light gray background
(#f0f0f0).
•The scrollbar thumb is styled with a primary blue
color (#3498db), rounded edges, and a border to
give it a distinct look against the track.
11: CSS Shapes and Clip Paths
• CSS provides powerful tools for creating non-rectangular shapes that
can enhance the design of web applications by breaking away from the
typical boxy look. With CSS Clip Paths and Shapes, you can easily
create circles, polygons, ellipses, and other unique shapes without
relying on images or complex markup.