when can i skip './' in HTML relative path? - relative-path

When i found about relative path, Many documents said i can skip ./ for current folder path.
But when i publish github pages, that path (skip ./ => images/name.jpg) doesn't work. (The index.html and images folder are in same location.)
So I fixed it to ./images/name.jpg, and it works!
I have question about that.
images/name.jpg <- this one, why doesn't it work?
Is there any condition to skip ./??
+++++
Actually I use many images and there codes are images/name.jpg. Most of them works well but only a few images doesn't work.

Use /images/name.jpg because index.html and images folder are in the same directory.
( use / for a folder, images/name.jpg didn't has / in front of the images folder. )
Edit:
You can refer to this document.
https://www.w3schools.com/html/html_filepaths.asp

Related

Nuxt: displaying an image from contents directory

I have a use-case wherein the contents directory besides the markdown and yaml files I have images too. Reason being it is convenient to have a set of related files in a subdirectory. I am aware of displaying images using the assets and static directories.
The Content directory is as shown:
content
- topics
- topic-a
content.yaml
cover.png
- topic-b
content.yaml
cover.png
Is there a way to access the png and display it? Thanks.

Vue: Cannot find module (image) in the file

I wrote a line which shows a picture like
And my asset folder is structured as
Yet this is throwing
Solutions I've tried:
Tried using
.
Still the same problem.
Any solutions?
Your screenshot shows assets under public, but your import URL uses the # prefix, which is a common alias for <projectRoot>/src.
You can move public/assets to src/assets so that the #/assets URL would be found:
public/assets --move--> src/assets
This solution has the advantage of minimizing the build output, only including files that are actually used in code. The included images also go through Webpack's processing, e.g., if you've configured image optimization.
Alternatively, you can keep public/assets and use a static asset URL, which is the base URL prefixed to the path under public. For the play.img and a base URL of / (the default), the static URL would be /assets/img/play.img:
<img src="/assets/img/play.img">

Reference HTML file in iframe with Quasar framework

I need to open an static HTML file inside an iframe because I need it to be printed silently, I’m trying setting the iframe src with absolete and relative paths but none of them work, I’ve tried moving my files inside public, static and assets folders with no success, I’ve seen that some people uses process.env.BASE_URL to access absole path of environment but it doesn’t work in Quasar.
Currently I have my files in a folder called ticketTemplates inside public folder placed at root, and it has two files: first.html and first.css, I’m doing the following:
<iframe src="ticketTemplates/first.html" frameborder="1"></iframe>
But as I said before it does not with relative or absolute paths. I've tried with http://localhost:8080/ticketTemplates/first.html too and it does not work.
Could you tell me how to achieve it?
I opened this tread in Quasar Forum and I found I was using an outdated version of #quasar/app, I updated my project and the content worked inside my iframe.
I moved my ticketTemplates folder inside public folder located in root directory, next to quasar.conf.js file and the resulting code was:
<iframe src="http://localhost:8080/ticketTemplates/first.html" frameborder="1"></iframe>
All the credit goes to the user who helped me.

Where should I place uploads dir in Nuxt.js project?

I had my uploads directory in a root, but to reach images inside the directory I had an api created.
Now the same but better solution would be to have this directory in a static/ so I could reach the images throught the link easily.
Another option would be placing it inside assets/ dirrectory and require() the image.
Which one is recommended and would be best solution?

Pathing from ../ in subdomain

Lets say I create a subdomain : http://subdomain.mydomain.com/
That was originally at this url : http://mydomain.com/subfolder/folder/
How would I fix pathing issues for
../ on http://subdomain.mydomain.com/
without a replacing code in .htaccess? is it possible?
let say I have some masive structure like this.
Now in this case I want to do is in the css -> style -> loginCSS I have a css file named as login and I want to take that
ca_grain_texture.jpg and set it as a background of my login.html file so we see that our html files are in the main directory
and also our css folder is in main directory
so if i want to grab the grain jpg file from my login.css file. I have to do somthing like this.
e.g
body{
background-image: url(../../../images/cs_grain_texture.jpg);
}
on writing ../ everytime it will jump one folder back similar to cd/ in command shell.
../ means it will go to loginCSS folder.
../../ means style folder.
../../../ means css which is the main directory.
I hope it helps understanding I understood this way and hope it clears your view.