Jump to content

Root folders...


Isaac19

Recommended Posts

So, can someone help me understand, visually, what this means and how to make it work? 

<img src="/images/picture.jpg"> WHEN picture.jpg is located in the images folder located at the root of the current web

 

What does it mean by "root of the current web"?

 

Link to comment
Share on other sites

Mmmmm id need to see a picture. I am a visual person. I understand for the most part, but I still don’t get this one. I have understood the others but not this one. I have tried putting it into practice, but it doesn’t work. .And the reason I have tried that is so I can get a visual of what it means in practice. 

Link to comment
Share on other sites

Localhost usually points to wwwroot or www and points to, as a website domain would, the root directory. You can create a virtual host that would point to a subfolder of root by specific url other than localhost that would treat that as root directly because it really points to http://localhost/virtualhostname/ even though you used http://virtualhostname/.

Link to comment
Share on other sites

Well, I know what you mean. But my intention in understanding this finds itself in the context of using the body { background-image: url (“image.gif”); property. You see, within the “____” there are several options, one of which is what I asked above: 

src="/images/picture.jpg" picture.jpg is located in the images folder at the root of the current web

 

So, what I want to know, is if I am creating a background-image for the body element, where exactly would my picture.jpg be when it is saying “Current web”? What does mean when it says current web? What is the current web? What web? Because as I understand, the current web could mean the many files and folders I have created within main folder where all folders and files are located for the website. Lol its vague in my opinion. I know that every / keeps pointing to the root above it. Like for example, I have a folder with images, and image1.jpg is within this folder, this to get it, I may refer to it as images/image1.jpg where images is the root folder for image1.jpg and if images folder is located within the main folder then you can refer to it as /images/image1.jpg.

And so on and so forth, but I want to know what “root of the current web” is. I can’t know this unless what “current web” is referring to and I need to understand this in the context of using images for background-image in body or simply for img within the main code of the body. 

Btw, thanks for helping. 

Link to comment
Share on other sites

It would be a relative path, and I am trying to picture the structure of everything relative to the very image in order to retrieve it and make it a background and do this from the CSS file. I think what you referred to above was an absolute path. I am trying to figure out how the image would be accessed from the images folder located at the current web. Ugh “current web” is what’s throwing me off. So, i ll give you the structure of the site I have going on

 

DESKTOP ———Level 1

MY WEBSITES FOLDER ———Level 2

Name of Website Folder ——— Level 3 

about.html

contact.html

products.html

Css Folder-

styles.css

Images Folder

img1.jpg

img2.jpg

img3.jpg

So, when w3school says: In this example, the file path points to a file in the images folder located AT THE ROOT of the current web. 

In order for me to understand this, I want to know what does it mean by CURRENT WEB? Does it mean Level 1? Level 2? Level 3? 

Clearly, for me, current web would be or mean Level 3, and I have tried it, but it doesn’t work, it doesn’t retrieve the image to make it a background within the body of the website through the body element in CSS. So, what does “CURRENT WEB” mean and what am I doing wrong in relation to the structure I just mentioned? 

 

Link to comment
Share on other sites

Current web = current web root directory preferably on local server NOT O/S filesystem which would not work in some circumstances.

Depending on where you apply CSS (such as inline, external file in css folder) determines the relative path you use, unless you use a absolute path each time.

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...