Archana B.R
Archana B.R

Reputation: 407

How to apply background image to body of the asp.net

I want to apply background image to the body of asp.net page. I have tried like this:

body
{
  font-family: sans-serif;
  font-weight:bold;
  background-image:url('C:\Users\ARCHANA\Downloads\Opera-Background-Blue-Swirls.jpg');
} 

Its is getting applied in the design part, but when I run the application, the image is not applied. I cant figure out what is the problem. Can anyone kindly help me. Thankyou in advance.

Upvotes: 0

Views: 203

Answers (2)

Adil
Adil

Reputation: 148178

You have to give url not the directory path.

body
{
  font-family: sans-serif;
  font-weight:bold;
  background-image:url('http://yourwebsite.com/Users/ARCHANA/Downloads/Opera-Background-Blue-Swirls.jpg');
} 

Upvotes: 1

McGarnagle
McGarnagle

Reputation: 102793

You can't reference a local file like that on a web server. Copy it somewhere in your application and reference it using a URI, ie,

background-image:url('/Images/Opera-Background-Blue-Swirls.jpg');

Upvotes: 4

Related Questions