Skip to main content

How to add a background image in css


 

The background-image property in CSS is employed to line a picture because the background of a component . Using this CSS property, we will set one or quite one background image for a component .


By default, the image is positioned at the top-left corner of a component and repeated both horizontally also as vertically. The background image should be chosen consistent with the text color. The bad combination of text and background image could also be a explanation for poorly designed and not readable webpage.


The url() value of this property allows us to incorporate a file path to any image. it'll show the element's background. we will use multiple images or a mix of gradients and pictures for the background. If the background-image is did not load or if we are using the gradients, but they're not supported on the corresponding browser then, we will use the fallback value (the value used because the substitution) because the background color of the element.


syntax:

  1. background-image: url();  


Example:
  1. <!DOCTYPE html>    
  2. <html>    
  3. <head>    
  4. <style>    
  5. body {    
  6.   background-image: url("cat.png");  
  7.   background-color: lightgray;  
  8.   }  
  9. </style>    
  10. </head>    
  11. <body>    
  12. </body>    
  13. </html>  




output:
output will be image of cat

Comments

Popular posts from this blog

Eduford HTML and CSS dynamic website template free with source code

               For more templates please subscribe the blog and share it             For more templates please subscribe the blog and share it                    For more templates please subscribe the blog and share it           For more templates please subscribe the blog and share it           For more templates please subscribe the blog and share it                                       DOWNLOAD TEMPLATE

Website background design using HTML and CSS

         Background plays a big role in website designing. When a visitor visits a website, the background works to attract him and keep him on the website.      Website background design using HTML and CSS HTML: <!DOCTYPE html> <html lang =" en "> <head> <meta charset =" UTF-8 "> <meta http-equiv =" X-UA-Compatible " content =" IE=edge "> <meta name =" viewport " content =" width=device-width, initial-scale=1.0 "> <title> animated background </title> <link rel =" stylesheet " href =" style.css "> </head> <body> <div class =" wrapper "> <h2> Animated Background </h2> <div class =" box "> <div> </div> <div> </div> <div> </div> <div> </div> ...

Why do front-end developer need a CSS framework?

  CSS frameworks have their downsides. So you would like to know whether you would like one or not. Here are a couple of strong arguments for using the frameworks: To build a website/web application faster You can save time by having a solid foundation that you simply can believe . CSS frameworks give web developers something that they're going to use and customize (if required). And for people who have limited coding skills, employing a CSS framework is that the sole because of create a solid product. To validate the planning hypothesis You can build an answer and test it together with your users. it's much faster and easier to make a prototype or wireframe with a framework instead of roll in the hay from scratch. PS:Designers also can create prototypes/wireframes employing a rapid prototyping tool. CSS frameworks works as per your needs There are tons of great frameworks you'll choose between . such as: Bootstrap Materialize Bulma Semantic ui Foundation