Learn visual design elements including color theory, typography, layout principles, and visual hierarchy for effective UI design.
Learn visual design elements including color theory, typography, layout principles, and visual hierarchy for effective UI design.
Understand color theory, psychology, and how to use colors effectively in UI design to create meaningful user experiences.
Content by: Yurmi Bhut
UI/UX Designer
Color is one of the most powerful tools in a designer's toolkit. Understanding color theory helps create visually appealing and psychologically effective designs.
Test your understanding of this topic:
Master typography principles, font selection, and text hierarchy to create readable and visually appealing interfaces.
Content by: Chirag Gondaliya
UI/UX Designer
Typography is the art of arranging type to make written language legible, readable, and appealing when displayed. Good typography enhances user experience and readability.
Test your understanding of this topic:
Learn layout principles, grid systems, and spatial relationships to create organized and visually balanced designs.
Content by: Yurmi Bhut
UI/UX Designer
Layout is the arrangement of visual elements on a page. Good layout creates visual hierarchy, guides user attention, and makes content easy to scan and understand.
Test your understanding of this topic:
Get hands-on experience implementing visual design principles with practical examples and code implementations.
Content by: Chirag Gondaliya
UI/UX Designer
/* CSS Color System Implementation */
:root {
/* Primary Color Palette */
--primary-50: #eff6ff;
--primary-100: #dbeafe;
--primary-200: #bfdbfe;
--primary-300: #93c5fd;
--primary-400: #60a5fa;
--primary-500: #3b82f6;
--primary-600: #2563eb;
--primary-700: #1d4ed8;
--primary-800: #1e40af;
--primary-900: #1e3a8a;
/* Neutral Color Palette */
--neutral-50: #fafafa;
--neutral-100: #f5f5f5;
--neutral-200: #e5e5e5;
--neutral-300: #d4d4d4;
--neutral-400: #a3a3a3;
--neutral-500: #737373;
--neutral-600: #525252;
--neutral-700: #404040;
--neutral-800: #262626;
--neutral-900: #171717;
/* Semantic Colors */
--success-500: #10b981;
--warning-500: #f59e0b;
--error-500: #ef4444;
--info-500: #3b82f6;
}
/* Color Utility Classes */
.bg-primary-500 { background-color: var(--primary-500); }
.bg-primary-600 { background-color: var(--primary-600); }
.text-primary-500 { color: var(--primary-500); }
.text-primary-600 { color: var(--primary-600); }
.bg-neutral-50 { background-color: var(--neutral-50); }
.bg-neutral-100 { background-color: var(--neutral-100); }
.text-neutral-900 { color: var(--neutral-900); }
.text-neutral-600 { color: var(--neutral-600); }
/* Semantic Color Classes */
.bg-success { background-color: var(--success-500); }
.bg-warning { background-color: var(--warning-500); }
.bg-error { background-color: var(--error-500); }
.bg-info { background-color: var(--info-500); }
.text-success { color: var(--success-500); }
.text-warning { color: var(--warning-500); }
.text-error { color: var(--error-500); }
.text-info { color: var(--info-500); }
/* Color Contrast Utilities */
.text-high-contrast { color: var(--neutral-900); }
.text-medium-contrast { color: var(--neutral-600); }
.text-low-contrast { color: var(--neutral-400); }
/* Interactive Color States */
.btn-primary {
background-color: var(--primary-500);
color: white;
transition: background-color 0.2s ease;
}
.btn-primary:hover {
background-color: var(--primary-600);
}
.btn-primary:active {
background-color: var(--primary-700);
}
/* Color Accessibility */
@media (prefers-color-scheme: dark) {
:root {
--neutral-50: #171717;
--neutral-100: #262626;
--neutral-900: #fafafa;
--neutral-600: #a3a3a3;
}
}
/* Typography System Implementation */
:root {
/* Font Families */
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
--font-serif: 'Georgia', 'Times New Roman', serif;
--font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
/* Font Sizes - Modular Scale (1.25 ratio) */
--text-xs: 0.75rem; /* 12px */
--text-sm: 0.875rem; /* 14px */
--text-base: 1rem; /* 16px */
--text-lg: 1.125rem; /* 18px */
--text-xl: 1.25rem; /* 20px */
--text-2xl: 1.5rem; /* 24px */
--text-3xl: 1.875rem; /* 30px */
--text-4xl: 2.25rem; /* 36px */
--text-5xl: 3rem; /* 48px */
--text-6xl: 3.75rem; /* 60px */
/* Line Heights */
--leading-none: 1;
--leading-tight: 1.25;
--leading-snug: 1.375;
--leading-normal: 1.5;
--leading-relaxed: 1.625;
--leading-loose: 2;
/* Font Weights */
--font-thin: 100;
--font-extralight: 200;
--font-light: 300;
--font-normal: 400;
--font-medium: 500;
--font-semibold: 600;
--font-bold: 700;
--font-extrabold: 800;
--font-black: 900;
/* Letter Spacing */
--tracking-tighter: -0.05em;
--tracking-tight: -0.025em;
--tracking-normal: 0em;
--tracking-wide: 0.025em;
--tracking-wider: 0.05em;
--tracking-widest: 0.1em;
}
/* Typography Utility Classes */
.text-xs { font-size: var(--text-xs); line-height: var(--leading-normal); }
.text-sm { font-size: var(--text-sm); line-height: var(--leading-normal); }
.text-base { font-size: var(--text-base); line-height: var(--leading-normal); }
.text-lg { font-size: var(--text-lg); line-height: var(--leading-relaxed); }
.text-xl { font-size: var(--text-xl); line-height: var(--leading-relaxed); }
.text-2xl { font-size: var(--text-2xl); line-height: var(--leading-tight); }
.text-3xl { font-size: var(--text-3xl); line-height: var(--leading-tight); }
.text-4xl { font-size: var(--text-4xl); line-height: var(--leading-tight); }
.text-5xl { font-size: var(--text-5xl); line-height: var(--leading-tight); }
.text-6xl { font-size: var(--text-6xl); line-height: var(--leading-tight); }
/* Font Weight Classes */
.font-thin { font-weight: var(--font-thin); }
.font-light { font-weight: var(--font-light); }
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }
/* Font Family Classes */
.font-sans { font-family: var(--font-sans); }
.font-serif { font-family: var(--font-serif); }
.font-mono { font-family: var(--font-mono); }
/* Letter Spacing Classes */
.tracking-tighter { letter-spacing: var(--tracking-tighter); }
.tracking-tight { letter-spacing: var(--tracking-tight); }
.tracking-normal { letter-spacing: var(--tracking-normal); }
.tracking-wide { letter-spacing: var(--tracking-wide); }
.tracking-wider { letter-spacing: var(--tracking-wider); }
.tracking-widest { letter-spacing: var(--tracking-widest); }
/* Typography Hierarchy */
.heading-1 {
font-size: var(--text-4xl);
font-weight: var(--font-bold);
line-height: var(--leading-tight);
letter-spacing: var(--tracking-tight);
font-family: var(--font-sans);
}
.heading-2 {
font-size: var(--text-3xl);
font-weight: var(--font-semibold);
line-height: var(--leading-tight);
letter-spacing: var(--tracking-tight);
}
.heading-3 {
font-size: var(--text-2xl);
font-weight: var(--font-semibold);
line-height: var(--leading-tight);
}
.body-large {
font-size: var(--text-lg);
line-height: var(--leading-relaxed);
font-weight: var(--font-normal);
}
.body {
font-size: var(--text-base);
line-height: var(--leading-normal);
font-weight: var(--font-normal);
}
.body-small {
font-size: var(--text-sm);
line-height: var(--leading-normal);
font-weight: var(--font-normal);
}
.caption {
font-size: var(--text-xs);
line-height: var(--leading-normal);
font-weight: var(--font-medium);
text-transform: uppercase;
letter-spacing: var(--tracking-wide);
}
/* Responsive Typography */
@media (max-width: 768px) {
.heading-1 { font-size: var(--text-3xl); }
.heading-2 { font-size: var(--text-2xl); }
.heading-3 { font-size: var(--text-xl); }
.body-large { font-size: var(--text-base); }
}
/* Typography Accessibility */
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* CSS Grid System Implementation */
:root {
/* Grid Breakpoints */
--breakpoint-sm: 640px;
--breakpoint-md: 768px;
--breakpoint-lg: 1024px;
--breakpoint-xl: 1280px;
--breakpoint-2xl: 1536px;
/* Grid Columns */
--grid-columns: 12;
--grid-gutter: 1.5rem;
--grid-margin: 1rem;
/* Container Max Widths */
--container-sm: 640px;
--container-md: 768px;
--container-lg: 1024px;
--container-xl: 1280px;
--container-2xl: 1536px;
}
/* Container System */
.container {
width: 100%;
margin-left: auto;
margin-right: auto;
padding-left: var(--grid-margin);
padding-right: var(--grid-margin);
}
.container-sm {
max-width: var(--container-sm);
}
.container-md {
max-width: var(--container-md);
}
.container-lg {
max-width: var(--container-lg);
}
.container-xl {
max-width: var(--container-xl);
}
.container-2xl {
max-width: var(--container-2xl);
}
/* Grid System */
.grid {
display: grid;
gap: var(--grid-gutter);
}
/* 12-Column Grid */
.grid-cols-12 {
grid-template-columns: repeat(12, 1fr);
}
.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }
.col-span-4 { grid-column: span 4 / span 4; }
.col-span-5 { grid-column: span 5 / span 5; }
.col-span-6 { grid-column: span 6 / span 6; }
.col-span-7 { grid-column: span 7 / span 7; }
.col-span-8 { grid-column: span 8 / span 8; }
.col-span-9 { grid-column: span 9 / span 9; }
.col-span-10 { grid-column: span 10 / span 10; }
.col-span-11 { grid-column: span 11 / span 11; }
.col-span-12 { grid-column: span 12 / span 12; }
/* Responsive Grid Classes */
@media (min-width: 640px) {
.sm\:col-span-1 { grid-column: span 1 / span 1; }
.sm\:col-span-2 { grid-column: span 2 / span 2; }
.sm\:col-span-3 { grid-column: span 3 / span 3; }
.sm\:col-span-4 { grid-column: span 4 / span 4; }
.sm\:col-span-6 { grid-column: span 6 / span 6; }
.sm\:col-span-12 { grid-column: span 12 / span 12; }
}
@media (min-width: 768px) {
.md\:col-span-1 { grid-column: span 1 / span 1; }
.md\:col-span-2 { grid-column: span 2 / span 2; }
.md\:col-span-3 { grid-column: span 3 / span 3; }
.md\:col-span-4 { grid-column: span 4 / span 4; }
.md\:col-span-6 { grid-column: span 6 / span 6; }
.md\:col-span-8 { grid-column: span 8 / span 8; }
.md\:col-span-12 { grid-column: span 12 / span 12; }
}
@media (min-width: 1024px) {
.lg\:col-span-1 { grid-column: span 1 / span 1; }
.lg\:col-span-2 { grid-column: span 2 / span 2; }
.lg\:col-span-3 { grid-column: span 3 / span 3; }
.lg\:col-span-4 { grid-column: span 4 / span 4; }
.lg\:col-span-6 { grid-column: span 6 / span 6; }
.lg\:col-span-8 { grid-column: span 8 / span 8; }
.lg\:col-span-9 { grid-column: span 9 / span 9; }
.lg\:col-span-12 { grid-column: span 12 / span 12; }
}
/* Grid Gap Utilities */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
/* Grid Row Utilities */
.grid-rows-1 { grid-template-rows: repeat(1, 1fr); }
.grid-rows-2 { grid-template-rows: repeat(2, 1fr); }
.grid-rows-3 { grid-template-rows: repeat(3, 1fr); }
.grid-rows-4 { grid-template-rows: repeat(4, 1fr); }
.grid-rows-5 { grid-template-rows: repeat(5, 1fr); }
.grid-rows-6 { grid-template-rows: repeat(6, 1fr); }
.row-span-1 { grid-row: span 1 / span 1; }
.row-span-2 { grid-row: span 2 / span 2; }
.row-span-3 { grid-row: span 3 / span 3; }
.row-span-4 { grid-row: span 4 / span 4; }
.row-span-5 { grid-row: span 5 / span 5; }
.row-span-6 { grid-row: span 6 / span 6; }
/* Grid Alignment */
.items-start { align-items: start; }
.items-center { align-items: center; }
.items-end { align-items: end; }
.items-stretch { align-items: stretch; }
.justify-start { justify-items: start; }
.justify-center { justify-items: center; }
.justify-end { justify-items: end; }
.justify-stretch { justify-items: stretch; }
/* Grid Content Alignment */
.content-start { align-content: start; }
.content-center { align-content: center; }
.content-end { align-content: end; }
.content-between { align-content: space-between; }
.content-around { align-content: space-around; }
.content-evenly { align-content: space-evenly; }
/* Grid Self Alignment */
.self-start { align-self: start; }
.self-center { align-self: center; }
.self-end { align-self: end; }
.self-stretch { align-self: stretch; }
/* Grid Justify Self */
.justify-self-start { justify-self: start; }
.justify-self-center { justify-self: center; }
.justify-self-end { justify-self: end; }
.justify-self-stretch { justify-self: stretch; }
/* Grid Areas */
.grid-areas {
grid-template-areas:
"header header header"
"sidebar main aside"
"footer footer footer";
}
.header { grid-area: header; }
.sidebar { grid-area: sidebar; }
.main { grid-area: main; }
.aside { grid-area: aside; }
.footer { grid-area: footer; }
/* Responsive Grid Example */
.responsive-layout {
display: grid;
gap: 1rem;
grid-template-columns: 1fr;
}
@media (min-width: 640px) {
.responsive-layout {
grid-template-columns: repeat(2, 1fr);
}
}
@media (min-width: 1024px) {
.responsive-layout {
grid-template-columns: repeat(3, 1fr);
}
}
@media (min-width: 1280px) {
.responsive-layout {
grid-template-columns: repeat(4, 1fr);
}
}
/* Visual Hierarchy Implementation */
:root {
/* Z-Index Scale */
--z-dropdown: 1000;
--z-sticky: 1020;
--z-fixed: 1030;
--z-modal-backdrop: 1040;
--z-modal: 1050;
--z-popover: 1060;
--z-tooltip: 1070;
/* Shadow Scale */
--shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
--shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
--shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
/* Border Radius Scale */
--radius-none: 0px;
--radius-sm: 0.125rem;
--radius-md: 0.375rem;
--radius-lg: 0.5rem;
--radius-xl: 0.75rem;
--radius-2xl: 1rem;
--radius-3xl: 1.5rem;
--radius-full: 9999px;
}
/* Shadow Utilities */
.shadow-xs { box-shadow: var(--shadow-xs); }
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }
/* Border Radius Utilities */
.rounded-none { border-radius: var(--radius-none); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-3xl { border-radius: var(--radius-3xl); }
.rounded-full { border-radius: var(--radius-full); }
/* Z-Index Utilities */
.z-dropdown { z-index: var(--z-dropdown); }
.z-sticky { z-index: var(--z-sticky); }
.z-fixed { z-index: var(--z-fixed); }
.z-modal-backdrop { z-index: var(--z-modal-backdrop); }
.z-modal { z-index: var(--z-modal); }
.z-popover { z-index: var(--z-popover); }
.z-tooltip { z-index: var(--z-tooltip); }
/* Visual Hierarchy Components */
.card {
background: white;
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
border: 1px solid var(--neutral-200);
transition: all 0.2s ease;
}
.card:hover {
box-shadow: var(--shadow-md);
transform: translateY(-2px);
}
.card-elevated {
box-shadow: var(--shadow-lg);
}
.card-floating {
box-shadow: var(--shadow-xl);
}
/* Button Hierarchy */
.btn-primary {
background: var(--primary-500);
color: white;
padding: 0.75rem 1.5rem;
border-radius: var(--radius-md);
font-weight: 600;
box-shadow: var(--shadow-sm);
transition: all 0.2s ease;
}
.btn-primary:hover {
background: var(--primary-600);
box-shadow: var(--shadow-md);
transform: translateY(-1px);
}
.btn-secondary {
background: var(--neutral-100);
color: var(--neutral-700);
padding: 0.75rem 1.5rem;
border-radius: var(--radius-md);
font-weight: 500;
border: 1px solid var(--neutral-300);
transition: all 0.2s ease;
}
.btn-secondary:hover {
background: var(--neutral-200);
border-color: var(--neutral-400);
}
/* Form Hierarchy */
.form-input {
padding: 0.75rem;
border: 1px solid var(--neutral-300);
border-radius: var(--radius-md);
font-size: 1rem;
transition: all 0.2s ease;
}
.form-input:focus {
outline: none;
border-color: var(--primary-500);
box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}
.form-input.error {
border-color: var(--error-500);
box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}
/* Navigation Hierarchy */
.nav-primary {
background: white;
box-shadow: var(--shadow-sm);
border-bottom: 1px solid var(--neutral-200);
z-index: var(--z-sticky);
}
.nav-item {
padding: 1rem;
color: var(--neutral-600);
transition: color 0.2s ease;
}
.nav-item:hover {
color: var(--primary-600);
}
.nav-item.active {
color: var(--primary-600);
border-bottom: 2px solid var(--primary-500);
}
/* Modal Hierarchy */
.modal-backdrop {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgb(0 0 0 / 0.5);
z-index: var(--z-modal-backdrop);
}
.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: white;
border-radius: var(--radius-xl);
box-shadow: var(--shadow-2xl);
z-index: var(--z-modal);
max-width: 90vw;
max-height: 90vh;
overflow: auto;
}
/* Tooltip Hierarchy */
.tooltip {
position: absolute;
background: var(--neutral-900);
color: white;
padding: 0.5rem 0.75rem;
border-radius: var(--radius-md);
font-size: 0.875rem;
box-shadow: var(--shadow-lg);
z-index: var(--z-tooltip);
pointer-events: none;
}
.tooltip::before {
content: '';
position: absolute;
top: -4px;
left: 50%;
transform: translateX(-50%);
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-bottom: 4px solid var(--neutral-900);
}
/* Responsive Hierarchy */
@media (max-width: 768px) {
.card {
border-radius: var(--radius-md);
box-shadow: var(--shadow-xs);
}
.btn-primary,
.btn-secondary {
padding: 0.875rem 1.25rem;
font-size: 1rem;
}
.modal {
margin: 1rem;
max-width: calc(100vw - 2rem);
max-height: calc(100vh - 2rem);
}
}
Test your understanding of this topic:
Continue your learning journey and master the next set of concepts.
Continue to Module 3