Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

relative path problem between folder css and images , ?

Featured Replies

The file index.php is formatted by means the file style.css which is inside the folder css.

All works fine except that there are two images on the css that I can´t manage them to be rendered.

The folders where the files are placed are the following :

 

root

.

.

.

- php [index.php]

- css [style.css]

- images [image1.png , image2.png]

.

.

This is part of css just to illustrate :

 

input.button {

cursor: pointer;

border: none;

font-weight: bold;

background: url(../images/image1.png) no-repeat left top;

width: 90px;

height: 28px;

margin-left: 150px;

}

 

For the sake of a test I´ve pasted inside the css folder both images and removed the relative path changing background:

 

url(../images/image1.png) by background: url(image1.png).

 

As I expected it worked , images are visualizaed , what proves that the problem is on the path.

If I understood properly two dots and a slash mean go up one level : ../ In this case between folder css and images there is one level.

 

So why the images do not appear ? what is wrong ?

Have you tried to use background-image?

This maybe solves the problem

 

input.button {
background-image: url(../images/titel.jpg);
}

 

Should work, you sure it's not a typo? Or if you're on a web server, you sure the images are in the right place?

 

If you only have one stylesheet, I don't see a need for a css dir, just put it root and you don't have to worry about ../, I keep my style.css in the root folder anyway.

 

~evu.

  • Author

1- Have you tried to use background-image?

as posted below it is already this way a background-image.

 

2- ... sure it's not a typo? / sure the images are in the right place? / keep the css in the root

Nope , I checked and rechecked , all seems fine : the images are in the folder "images" / I like to separate css , images , php , js , etc.

 

 

SOLVED : simply I deleted all files on the server and reuploaded then it worked

 

Thank you all very much for your answer

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.