Jump to content
Isaac19

Root folders...

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"?

 

Share this post


Link to post
Share on other sites

The parent directory where your website folders/files are placed and where your domains address would point to.

Edited by dsonesuk

Share this post


Link to post
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. 

Share this post


Link to post
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/.

Share this post


Link to post
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. 

Share this post


Link to post
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? 

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...