Turning Learners Into Developers
Codekilla
CODEKILLA
// examples.css()

CSS examples.

01 / 20

Center with Flexbox

js
.hero {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
02 / 20

Responsive Grid

js
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
03 / 20

Hover Transition

js
.btn {
  background: #EAB308;
  transition: transform 0.2s ease;
}
.btn:hover { transform: translateY(-2px); }
04 / 20

CSS Variables

js
:root {
  --accent: #10B981;
  --bg: #0a0a0a;
}
h1 { color: var(--accent); }
body { background: var(--bg); }
05 / 20

Keyframe Animation

js
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.card { animation: fadeUp 0.5s ease-out; }
06 / 20

Media Query

js
@media (max-width: 640px) {
  .container { padding: 1rem; }
  .grid { grid-template-columns: 1fr; }
}
07 / 20

Box Shadow

js
.card {
  box-shadow: 0 12px 32px rgba(234, 179, 8, 0.2);
  border-radius: 8px;
}
08 / 20

Gradient Background

js
.hero {
  background: linear-gradient(135deg, #10B981, #EAB308);
}
09 / 20

Sticky Header

js
.navbar { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(10px); }
10 / 20

Glassmorphism

js
.panel {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
11 / 20

:hover, :focus, :active

js
a:hover { color: #EAB308; }
input:focus { outline: 2px solid #10B981; }
button:active { transform: translateY(1px); }
12 / 20

Pseudo-elements ::before

js
.badge::before {
  content: '★';
  margin-right: 4px;
  color: gold;
}
13 / 20

Nth-child Selector

js
.list li:nth-child(odd)  { background: #111; }
.list li:nth-child(even) { background: #1a1a1a; }
14 / 20

Aspect Ratio

js
.video { aspect-ratio: 16 / 9; width: 100%; background: #000; }
15 / 20

Truncate Text

js
.one-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
16 / 20

Scroll-snap

js
.carousel {
  scroll-snap-type: x mandatory;
  overflow-x: auto;
  display: flex;
}
.slide { scroll-snap-align: center; flex: 0 0 100%; }
17 / 20

Custom Scrollbar

js
*::-webkit-scrollbar { width: 8px; }
*::-webkit-scrollbar-thumb { background: #eab308; border-radius: 4px; }
18 / 20

Dark-mode toggle

js
@media (prefers-color-scheme: dark) {
  body { background: #0a0a0a; color: #f1f5f9; }
}
19 / 20

Transform & Rotate

js
.icon:hover { transform: rotate(180deg) scale(1.2); transition: 0.3s; }
20 / 20

Container Queries

js
@container (min-width: 600px) {
  .card { display: grid; grid-template-columns: 1fr 2fr; }
}