Close-up of colorful CSS code lines on a computer screen for web development.

Definicja i historia CSS

Podstawowe sposoby stosowania CSS

a) Wewnętrzne style (inline CSS)

<p style="color: red; font-size: 20px;">Czerwony tekst</p>

b) Wewnętrzny arkusz stylów (internal CSS)

<head>
    <style>
        p {
            color: blue;
            font-size: 18px;
        }
    </style>
</head>

c) Zewnętrzny arkusz stylów (external CSS)

<link rel="stylesheet" href="styles.css">
p {
    color: green;
    font-size: 16px;
}

Selektory i właściwości CSS

a) Selektory podstawowe

b) Selektory zaawansowane

Responsywność w CSS

a) Media Queries

@media (max-width: 768px) {
    body {
        background-color: lightgray;
    }
}

b) Flexbox

.container {
    display: flex;
    justify-content: center;
    align-items: center;
}

c) Grid Layout

.container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
}

Animacje i efekty w CSS

a) Przejścia (Transitions)

a {
    color: blue;
    transition: color 0.5s ease-in-out;
}

a:hover {
    color: red;
}

b) Animacje CSS

@keyframes przesun {
    0% { transform: translateX(0); }
    100% { transform: translateX(100px); }
}

.element {
    animation: przesun 2s linear infinite;
}

Podsumowanie

Podobne wpisy