nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 09 Sep 2012 09:26 PM |
Dang, can't post what I wanted to post here so..
pastebin/s6bNyZ6j |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 09 Sep 2012 09:30 PM |
| c'mon you web developing wizards. |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2012 09:44 PM |
As a best practice, all relative urls should be specified against the site root. You want the same code/styling/images/whatever to work regardless of what page you're on. Even though the '..' notation worked for something, you should avoid using it all together.
'/Images/Label.png' is probably what you want. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 09 Sep 2012 09:48 PM |
"As a best practice, all relative urls should be specified against the site root."
Any quick demo on how I would do that?
"Even though the '..' notation worked for something"
for some reason it actually doesn't work anymore... :( |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 09 Sep 2012 09:53 PM |
| Also note that 'background:url(../Images/Label.png);' is being ran through the .CSS file. |
|
|
| Report Abuse |
|
|
|
| 09 Sep 2012 10:34 PM |
"Any quick demo on how I would do that?"
If you specify your urls with a leading '/', it will be relative to the site root. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 09 Sep 2012 11:20 PM |
| Well, still for some reason I can't use "../Images/Label.png" in the .css file, however I can use it in the .html file (using css style). |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2012 06:16 AM |
I always use ./ for root stuff to avoid any issues. What exactly is the file hierarchy of the root?
ROOT --index.html --CSS.css --Images ----Label.png
Right? If that is so, using ./ instead of ../ should suffice. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 10 Sep 2012 06:24 AM |
| './Images/Label.png' seems to work (thanks) while before I was using '../Navbar/Images/Label.png' |
|
|
| Report Abuse |
|
|
lombardo2
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 1604 |
|
|
| 10 Sep 2012 01:43 PM |
| Look, when you start with / it moves to the root directory, using ../ moves one directory backward per ../ so ../../ moves 2 directories backward |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 10 Sep 2012 02:03 PM |
./ is meaningless. It represents the current directory. I'm pretty sure `././././././Images` is perfectly valid and would work!
If your page is at `somesite.com/folder/page`, you can use `/Images/etc/` to refer to `somesite.com/Images/etc`. This will work regardless of the location of `page`. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 10 Sep 2012 02:24 PM |
"Look, when you start with / it moves to the root directory, using ../ moves one directory backward per ../ so ../../ moves 2 directories backward"
Navbar/ NavBar/HTML.html NavBar/CSS.css Navbar/Images Navbar/Images/Label.png Navbar/Images/Hover.png
CSS: '../Images/Label.png' doesn't work HTML: '../Images/Label.png' does work.
I got a solution, but it doesn't seem valid as '../Images/Label.png' should work, and it works when used in a .html document, but not in the CSS document. Why? |
|
|
| Report Abuse |
|
|
lombardo2
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 1604 |
|
|
| 10 Sep 2012 02:59 PM |
you need to use url(path) to load things in css, like
background-image:url(../Images/Label.png); |
|
|
| Report Abuse |
|
|
lombardo2
|
  |
| Joined: 30 Nov 2008 |
| Total Posts: 1604 |
|
|
| 10 Sep 2012 03:04 PM |
| Oh sorry, you did... Mmm the css file is in the root directory, so when you use ../ it can't go backward so it doesn't work. I arranged files as you specified and used dreamweaver, it gave me this url(images/img.png) |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 10 Sep 2012 03:12 PM |
| Did you even read what ostrichsized and I wrote? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 10 Sep 2012 03:14 PM |
"Did you even read what ostrichsized and I wrote?"
Yes and neither of the solutions worked. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 11 Sep 2012 01:13 AM |
Then you didn't read it properly.
The URL you want, from what you've told us, is /Navbar/Images/Label.png
|
|
|
| Report Abuse |
|
|
|
| 11 Sep 2012 01:41 AM |
. is the current location. .. is the current location's parent. \ is the top location, the root location.
You can figure out the rest from that. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 11 Sep 2012 02:23 PM |
Julien, I already have... Before I posted this.
"/Navbar/Images/Label.png"
Yes, and that works. But as I was viewing page's CSS I noticed they were always using short addresses. |
|
|
| Report Abuse |
|
|