Card: Color and Shadow

Colors & Shadows

The Alchemy of Glow and Shade

In these lines, you’ll discover how to wield the magic of CSS to make colors and shadows so dazzling that even a seasoned mage would pause in awe. Your text will glow in the dark, while background colors swirl like mystical mists, framing your stories in radiant brilliance. And shadows? They lend depth to your boxes, making them emerge from the page with a whisper of mystery, as if sharing a secret with the reader.

But be warned: colors and shadows are like magical potions. One drop too many, and your page might resemble a chaotic experiment gone wrong, the kind of potion even the bravest wizard hesitates to touch. Design wisely, and your page will shine like a luminous star in the CSS constellation.

Colors & Effects

Light, shadows, contrast – bring your elements to life!

Token: color

Text Color

The Artist’s Palette

Like an alchemist blending magical hues, text color breathes life into your words. A fiery red ignites passion, while a gentle green whispers the freshness of a tranquil forest into your sentences.

h1 {
    color: red;
}

color: This property assigns your text a color, transforming it into a vibrant piece of your digital masterpiece.

Token: background-color

Background Color

The Stage for the Grand Performance

Curtains up! Background color sets the perfect scene for your text’s big debut. With a touch of CSS magic, you roll out the carpet of colors, creating a backdrop where your content can truly shine.

h1 {
    background-color: green;
}

background-color: This property assigns a background color to your text block, making it the star of the show.

Token: text-shadow

Text Shadow

The Dramatic Entrance

A well-placed text shadow is like a mysterious mist swirling around your words. It adds depth and drama, making your headings pop even on the most chaotic of backgrounds.

h1 {
    text-shadow: 2px 2px 5px grey
}

text-shadow: This property is crafted from four components: horizontal and vertical offset, a blur radius, and a color – all combining to create a striking visual effect.

Token: box-shadow

Box Shadow

The Magic of Levitation

With a box shadow, your element seems to hover effortlessly above the page, as if lifted by an invisible spell. A touch of shadow here, a hint of light there, and your box takes center stage, ready for its grand performance under the spotlight.

h1 {
    box-shadow: 4px 4px 9px black;
}

This box features a shadow with 4 pixels of horizontal and vertical offset, a 9-pixel blur radius, and a black shadow color – subtle yet striking, like a magician’s flourish.

CSS
body {
    color: darkslategray;
}

h1 {
    color: forestgreen;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.magic-box {
    background-color: lightgoldenrodyellow;
    box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.3);
}
Scroll to Top