Here, if a browser understands the RGBa or HSLa value it will render it, and if it doesn’t, it will fall back to the hexadecimal value above it. The first background-color property will use a “safe” background color, such as a hexadecimal value, and the second background-color property will use an RGBa or HSLa value.
CSS cascades from the top of a file to the bottom of a file thus, we can use two background-color properties within a single rule set. If Internet Explorer 8 support is a concern, fortunately there is an easy way to provide a fallback background. And when a browser such as Internet Explorer 8 comes across a value it doesn’t recognize, it will ignore it. Browser support is specifically a problem with Internet Explorer 8, where RGBa and HSLa values are not supported. When using an RGBa or HSLa value as a transparent background color, it’s a good idea to provide a fallback color, too, because not all browsers recognize RGBa or HSLa values. Most commonly we’ll see hexadecimal values however, we may occasionally want to use RGBa or HSLa values for transparencies. As with other color values, we can pick from keywords, hexadecimal codes, and RGB, RGBa, HSL, and HSLa values. When adding a background color, we have a few options for the values we can use. Either property will work, and which one you decide to use depends on your preference as well as the case for which you’re using it. The background property accepts colors and images in shorthand form, while the background-color property is used strictly for setting solid background colors.
The quickest way to add a background to an element is to add a single-color background using the background or background-color property.
#How to create a background picture on fa how to#
In this lesson we’re going to take a look at how to assign different types of backgrounds, including gradients, to elements we’ll also play around with a handful of CSS3 properties specific to backgrounds. As we decide how to implement these backgrounds, we should keep in mind that every background contributes to the overall appearance of our website. Within CSS, element backgrounds can be a solid color, an image, a gradient, or a combination of these. They help create a site’s look and feel, establish groupings, and assign priority, and they have a considerable influence on a website’s usability.
Step 2: Now, we have to place the cursor in the head tag of the Html document and then define the styles inside the