Starlit Daily

📚 › CSS: style and layout

13. Positioning

Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.

position: relative keeps an element in the flow but lets you offset it. position: absolute places it relative to the nearest positioned ancestor. position: sticky keeps an element on screen while you scroll.

Top, right, bottom and left set the offsets.

Ver ejemplo

.badge {
  position: absolute;
  top: 8px;
  right: 8px;
}

✍️ Ahora te toca

Make .header stick to the top of the screen while scrolling.

← Volver al curso