In CSS, you can adjust the transparency of colors using alpha values. These values range from 0.0 (completely transparent) to 1.0 (fully opaque). You can set transparency for colors in RGB or HSL formats using rgba() and hsla().
/* Semi-transparent green background */ .midground { background-color: rgba(0, 255, 0, 0.5); } /* Very transparent yellow */ .foreground { background-color: hsla(60, 100%, 50%, 0.1); } /* Fully transparent color */ .transparent { color: transparent; }
Hexadecimal color codes are a way to specify colors using six digits. They include values for red, green, and blue. Shorter versions of hex codes can be used when the values are repeated.
/* Bright red color */ .red { color: #ff0000; } /* Short hex code for blue */ .short-blue { color: #00f; }
HSL stands for Hue, Saturation, and Lightness. It’s another way to define colors. Hue is the type of color, saturation controls the intensity of the color, and lightness adjusts how light or dark the color is.
/* Light blue color using HSL */ .light-blue { background-color: hsl(200, 70%, 50%); }
RGB stands for Red, Green, and Blue. You can mix these colors in different amounts to create various colors. Each color value ranges from 0 to 255.
/* Bright pink color using RGB */ .hot-pink { color: rgb(249, 2, 171); } /* Pure green color using RGB */ .green { color: rgb(0, 255, 0); }
CSS also supports named colors like 'aqua' and 'khaki'. These names are shorthand for common colors and can make your CSS code easier to read.
/* Aqua color for headings */ h1 { color: aqua; } /* Khaki color for list items */ li { color: khaki; }
Welcome to our comprehensive collection of programming language cheatsheets! Whether you're a seasoned developer or a beginner, these quick reference guides provide essential tips and key information for all major languages. They focus on core concepts, commands, and functions—designed to enhance your efficiency and productivity.
ManageEngine Site24x7, a leading IT monitoring and observability platform, is committed to equipping developers and IT professionals with the tools and insights needed to excel in their fields.
Monitor your IT infrastructure effortlessly with Site24x7 and get comprehensive insights and ensure smooth operations with 24/7 monitoring.
Sign up now!