4. How do you change the text color in CSS?

You can change the text color using the color property. You can use color names, hexadecimal color codes, RGB, RGBA, HSL, or HSLA values.

/* / Examples */ p { color: blue; /* Color name */ } h1 { color: #ff0000; /* Hexadecimal code */ } h2 { color: rgb(255, 0, 0); /* RGB */ } h3 { color: rgba(255, 0, 0, 0.5); /* RGBA (with transparency) */ } h4 { color: hsl(0, 100%, 50%); /* HSL */ } h5 { color: hsla(0, 100%, 50%, 0.5); /* HSLA (with transparency) */ }
devFlipCards 2024

Do you accept cookies?

Cookies are small amounts of data saved locally on you device, which helps our website - it saves your settings like theme or language. It helps in adjusting ads and in traffic analysis. By using this site, you consent cookies usage.