CSS Colour Properties
Tags: css, beginners, frontend, webdev
Published: 2023-10-26 09:14:18

CSS colour properties are the spice of web design, adding that extra flavour to our online creations. They're like the magic wands that let us pick and choose the perfect colours to make our websites and apps visually appealing and user-friendly. Here are some key players in the world of CSS colours:

**color**: This one is like your favourite pen, the one that gives your text its unique personality. It defines the colour of your text, making it pop, soothe, or whatever you want it to do. 

```
p {
color: #FF0000
}
```
You know those colour names you can use in CSS, like "red" and "blue"? Well, there are a whopping 147 of them! It's not just your basic colours; you've got all sorts of fancy shades like "darkslategray" and "burlywood" to play with. So, if you're ever feeling artsy or just want to save some time, you've got a whole rainbow of colour names to choose from right at your fingertips in CSS.



**background-color**: Think of this as the wallpaper for your website. It's the background colour that sets the stage for your content, creating the right mood. 

```
body {
background-color: #F0F0F0
}
```
Here's a neat thing about background colours: They're like the vibe-setters of the web, just like the colours you pick for your bedroom or living room. It turns out that the colours you see on a website can actually influence how you feel and act. For example, warm background colours like red or orange might make you feel a bit more energetic, while those cool blues and greens could make you feel all relaxed and trusting. So, without even realising it, the colours on a website can kind of steer our emotions and actions as we click around.



**border-color**: This is your way of putting a frame around your content. You get to choose the colour, making your elements more interesting.

```
div {
border-color: #333
}
```
Those borders in CSS are like the fancy frames around your pictures. But here's the fun part - web designers use them not just to keep things neat but also to make stuff pop. They pick border coloUrs that jazz things up, create visual tricks, or just make elements look cool. So, next time you spot a border, know that it's not just a line; it's like a little fashion statement for your web content! 



**outline-color**: Imagine it as a spotlight on your web elements. It's useful for highlighting form fields or interactive stuff.

```
input:focus {
outline-color: blue
}
```

Think of outline colours in CSS as the web's way of highlighting stuff. You know how you grab a highlighter to emphasise important points in a book? Well, outline colours do something similar for web forms and interactive things. The cool part is, you can actually pick your own outline colour to match your website's vibe. So, they're not just practical; they add a bit of your site's style to the mix



**box-shadow**: It's not just about colour; it's the technique to add depth. It's like placing a shadow under an element, making it stand out. You can pick the shadow's colour, size, and placement.

```
button {
box-shadow: 4px 4px 6px #888888
}
```
Box shadows are like the web design secret sauce that adds a touch of magic to elements, making them look fancy and three-dimensional. Think of it as a virtual makeover for web elements. The cool part is, you can easily customise these shadows to be big, small, soft, sharp, or even choose the colour. It's a nifty way to inject your personal style into your web design, making everything stand out and look super cool! 



**text-shadow**: This is the artist's brushstroke for your text. It adds a cool shadow effect, giving your words a bit of pizzazz, and yes, you can choose the shadow's colour.

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


```
Text shadows are like the jazz hands of typography. They're the secret sauce that makes your words stand out on your web page. Imagine a stylish, subtle shadow dancing behind your text, giving it that extra flair. What's awesome is that you can play around with the shadow's size, blur, and colour to suit your vibe. It's like giving your words a makeover, adding that touch of coolness that catches everyone's eye!



These CSS colour properties are your tools to add that creativity to your projects. They bridge the gap between art and web development, making your website visually appealing and engaging.