If there are spaces in folders or images, how is it resolved?

Asked

Viewed 40 times

0

In case I am learning WEB(HTML,php,Css and Javascript), and for html there is the function of by images, but I came across the difficulty of sending an image if it has spaces in the name or in the path.

 <body>
 <img src="../../pictures/Sample Pictures/Desert.jpg" width="400" height="300">
 </body>

I know that it is recommended not to use spaces for programming languages and etc, but I wanted to know if there is a way to resolve this without renaming folders or files, just for the same knowledge, because I actually have the habit of not using spaces. Does anyone know how to solve this, or just renaming msm?

1 answer

0


You can swap the spaces for the corresponding ASCII code preceded by %. the code would look something like:

 <body>
     <img src="../../pictures/Sample%20Pictures/Desert.jpg" width="400" height="300">
 </body>

Just to point out that this is not recommended, as you pointed out yourself.

  • 1

    All right, I get the idea.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.