PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 18, 2022

[FIXED] How can i set a background image with CSS?

 July 18, 2022     background, css, document-body, html, image     No comments   

Issue

I just started to learn HTML and CSS and i'd like to know how to set a background image covering the whole body element using CSS?

I've tried this way, searched an image on Google, copied and pasted its external link into CSS code and refreshed the page, but it doesn't seem working:

body {
 padding: 10px;
 background-image: src="https://backgroundcheckall.com/wp-content/uploads/2017/12/technology-background-image-11.jpg"; }

Do you know any better methods? Thank you!


Solution

You are following the wrong format, if you want to add the background-image, the correct format is

background-image: url('link to image');

In your code

body {
 padding: 10px;
 background-image: url("https://backgroundcheckall.com/wp-content/uploads/2017/12/technology-background-image-11.jpg"); 
}


Answered By - Ahad Aman
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing