File paths
In order for files to communicate with each other, you must provide a file path between them – basically a way for a file to know where another file is. To demonstrate this, we will add a little HTML code in our index.html file.
1. Copy the image you chose earlier in the images directory.
2. Open the index.html file and add the code below to the file, exactly as shown. Don’t worry about what it means at the moment – we’ll look at the structures in detail later in these series.
3. The <img src = “” other = “My image”> line is the HTML code that introduces an image into the page. We need to say where the picture is. The image is inside the images directory, which is in the same directory as index.html. To browse the file structure from index.html to our image, the path to the file we need is images / your image file.
4. Add the file path to your HTML code, between the double quotes of the attribute src = “”.
5. Save your HTML file, then upload it to your web browser (double-click the file).
Some general rules for file paths:
– To create a link to a target file from the same directory as the HTML file invoked, use only the file name, e.g. myimage.jpg.
– To refer to a file from a subdirectory, write the name of the director in front of the path, plus a forward slash, e.g. subdirectory/myimage.jpg.
– To create a link to a target file in the directory above the HTML file invoked, write two points. For example, if index.html is inside a test-site subdirectory and my-image.jpg is inside the test-site, you could refer to my-image.jpg from index.html using home/myimage.jpg.
-You can combine them as much as you want, for example, home/folder/ 2folder/image.jpg.
The Windows file system tends to use a backslash, not a forward slash, for example. C:\Windows. This doesn’t matter in HTML – even if you develop your site on Windows, you should use forward slashes in your code.
HTML (Hypertext Markup Language) is the code used to structure and display a web page and its content. For example, content can be structured into a set of paragraphs, a list of dots, or using images and data tables.
HTML is not a programming language; it is a markup language that defines the structure of your content. HTML is made up of several elements, which you close or frame different parts of the content to make it appear in a certain way or to behave in a certain way. Closing tags can make a word or image a link to another place, italicize words, and make the font size bigger or smaller, etc.
Continuing the articles on how to create a site we will talk about the basics in HTML, CSS, JavaScript as well as general rules regarding the publication of the site on the Internet.
Publishing a site is not a simple topic, mainly because there are different ways to do it.