Beginner CSS Interview Preparation Structure
Level Type
Beginner Basics (syntax, selectors, colors, units, box model)
🎯 Key CSS Topics You Must Prepare
📌 Basics & Syntax
-
What is CSS?
-
Types of CSS (inline, internal, external)
-
CSS Syntax: selector, property, value
-
How to link CSS to HTML
📌 Selectors
-
Universal (
*
), element (p
), class (.btn
), ID (#header
) -
Descendant (
div p
), child (div > p
), sibling (p + p
) -
Attribute selectors (
input[type="text"]
)
📌 Box Model
-
content → padding → border → margin
-
Use of
width
,height
,border
,outline
📌 Units
-
Absolute:
px
,cm
,in
-
Relative:
em
,rem
,%
,vw
,vh
📌 Typography & Color
-
font-family
,font-size
,color
,text-align
,line-height
-
background-color
,background-image
, gradients
📌 Layout & Positioning
-
display: block/inline/inline-block/flex/grid/none
-
position: static, relative, absolute, fixed, sticky
-
float
,clear
,z-index
📌 Flexbox
-
display: flex
,justify-content
,align-items
,flex-direction
📌 Grid
-
display: grid
,grid-template-columns
,gap
📌 Responsive Design
-
Media Queries:
@media (max-width: 768px) {...}
📌 Pseudo-classes and Elements
-
:hover
,:focus
,:nth-child()
,::before
,::after
📌 Transitions and Animations
-
transition
,animation
,@keyframes
📌 CSS Variables
-
Declaring & using custom properties:
--main-color: #333;
📌 Specificity & Inheritance
-
Inline > ID > Class > Element
-
Importance of
!important
📌 Accessibility & Best Practices
-
:focus
,outline
, readable font sizes -
Avoiding
!important
unless necessary -
Mobile-first design
🚀 Bonus Tips
🔹 2–3 Practical UI tasks to prepare:
-
A card component with image, title, button using Flexbox
-
A responsive navbar with hover effect
-
A two-column layout using Grid or Flexbox
🔹 Use Live Editors:
Practice on CodePen, JSFiddle, or PlayCode
🔹 Keep practicing these snippets:
-
Hover effects on buttons
-
Create a full-page layout (header, main, sidebar, footer)
-
Center a div vertically and horizontally
- Inline CSS (within element using
style=""
) - Internal CSS (inside
<style>
tag in<head>
) - External CSS (linked
.css
file)
<link>
tag with the href
attribute in the <head>
section of the HTML.id
and class
in CSS?#id
is unique, used once per page.class
can be reused multiple times
- Universal (
*
) Element (
p
,div
)Class (
.box
)ID (
#header
)Group (
h1, p
)Descendant (
div p
)
color
property?margin
and padding
?- Margin: Take space outside the element
- Padding: space inside the element (between content and border)
Comments
Post a Comment