-5

I'm in a Website Design class in school and I'm stuck on this project. I have to put 5 htmls and 5 pictures in seperate subfolders, leave a css file outside of both subfolders, and make relative paths between the css file and the html pages, and paths between the htmls and the pictures. I can't figure out how to get the css file to apply to each html, and how to get the images to pop up on the pages (I don't know how to make a path between the htmls and the pictures). I'm so sorry if this is hard to understand, I don't speak code

Alon Eitan
  • 11,997
  • 8
  • 49
  • 58
  • 1
    What have you tried so far? – Quentin Veron Feb 12 '19 at 20:17
  • 3
    Questions seeking help with ("**why isn't/how to make this code working?**") must include the desired behavior, a specific problem or error and _the **shortest code necessary to reproduce it** in the question itself_. See: How to create a [mcve]. – Asons Feb 12 '19 at 20:20

1 Answers1

1

First, you need to know how relative paths work:

A relative path refers to a location that is relative to a current directory. Relative paths make use of two special symbols, a dot (.) and a double-dot (..), which translate into the current directory and the parent directory. Double dots are used for moving up in the hierarchy. A single dot represents the current directory itself.

From: http://desktop.arcgis.com/en/arcmap/10.3/tools/supplement/pathnames-explained-absolute-relative-unc-and-url.htm#GUID-5118AC85-57E4-4027-AC24-FB6E99FADEFF

Now, I'm going to assume your top level ProjectFolder contains your css, a folder called htmlFolder with the html in it, and a folder called imageFolder with the images in it.

So, from the perspective of a file inside the htmlFolder, the css file is in the parent directory (the one directly 'above'), so your relative path might look like:

../myStyle.css

The images are in what is called a 'sibling' folder, meaning it shares the same parent. A sibling path looks like:

../imageFolder/myImage.png

The top answer on this related question gives a similar but more detailed explanation in the context of a website: Relative path in HTML

Meg
  • 938
  • 9
  • 20