Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

url property of background-image in css

I have a folder inside my ASP.NET web application. I put all css files inside 'App_Theme'. What is the right method to specify an image as background of a 'div' if I place image1.jpg inside "Icons/images" directory. The options for url are :-

  1. ./Icons/jquery/image1.jpg
  2. Icons/jquery/image1.jpg
  3. /Icons/jquery/image1.jpg

Which is correct ?

like image 859
mmk_open Avatar asked Jun 21 '11 09:06

mmk_open


2 Answers

@muhammed; write this for image path if your css in single folder

background-image: URL("../Icons/jquery/image1.jpg");

& if there is another folder inside of the main folder for example stylesheet folder & there is another folder inside it suppose css folder then we write

background-image: URL("../../Icons/jquery/image1.jpg");
like image 120
sandeep Avatar answered Oct 28 '22 06:10

sandeep


Go to your css file, right-click on the css class name > Build Style > Background > Browse the image. It'll put the URL in for you.

like image 22
Ruslan Avatar answered Oct 28 '22 07:10

Ruslan