Skip to main content

HTML File Paths

 HTML  FILE PATHS

In HTML, file paths are used to specify the location of external files, such as images, stylesheets, scripts, and other HTML documents. There are three types of file paths commonly used:

1. **Relative Paths**: Relative paths specify the location of a file relative to the current document. They are defined based on the directory structure of the website. Relative paths can be categorized into two types:

   - **Relative Paths without a leading slash**: These paths are relative to the current directory. For example, if your current file is located at `example.com/index.html` and you want to link to an image located in the same directory, you would use `image.jpg` as the path: `<img src="image.jpg">`.

   - **Relative Paths with a leading slash**: These paths are relative to the root directory of the website. For example, if your current file is located at `example.com/blog/index.html` and you want to link to a stylesheet located in the root directory, you would use `/css/style.css` as the path: `<link rel="stylesheet" href="/css/style.css">`.

2. **Absolute Paths**: Absolute paths specify the complete URL or file path to a resource. They include the protocol (`http://` or `https://`) and the full URL or file path. Absolute paths are typically used when linking to external resources on other websites. For example: `<script src="https://example.com/js/script.js"></script>`.

3. **Root-Relative Paths**: Root-relative paths are similar to relative paths with a leading slash, but instead of being relative to the website's root directory, they are relative to the server's root directory. They start with a leading slash (`/`) but do not include the domain name. For example: `<img src="/images/image.jpg">`.

It's important to note that the correct usage of file paths depends on the file's location relative to the current HTML document and the desired resource.

Comments

Popular posts from this blog

TYPE OF HTML CSS

 Types of HTML CSS To change a HTML documents style Three Types to Add CSS in HTML 1.      Inline CSS: To using by <p style> change a style of HTML Attribute.      2.     Internal CSS: by using <style> tag in the below of <head> tag.           3.    External CSS : By using <link> element in link to external CSS file. INLINE CSS We use inline CSS in a line      Example : <p style=“color:green;”> Green Text </p> Here we use inline css… INTERNAL CSS In this section we use Internal CSS.      We use <style> element under the <head> section. Example:           <style>                 p {color:green ;}                      </style> EXTERNAL CSS External CSS create a new fil...

HTML Basic

 How to Write HTML Tags All HTML document must start with <!DOCTYPE HTML> HTML Document start with <html> and end with </html> (that's call a start tag and end tags. The visible part of the document between <body> and </body> tags. Type of Heading Tags:  HTML document contains a 6 types of heading  we are heading describe with  <h1> heading 1 </h1> tags <h2>  heading 2  </h2>   <h3>  heading 3  </h3>   <h4>  heading 4  </h4>   <h5>  heading 5  </h5>   <h6>  heading 6  </h6> Every heading have a different fonts size. Example: Do practice and Touch with our blog  

Change the Style Elements in HTML

 HTML Styles Elements  What you learn today Use Background-color   for background color html page. Use color attribute for text color Use font-family for text fonts Use font-size for text size. Use text-align for text alignment Youtube channel : Like and Subscribe my Channel Example <!DOCTYPE html> <html> <head> <title> style sheet </title> </head> <body style =" background-color:purple; " > <p style =" color:red; "> this is text color </p> <p style =" font-family:arial; " > font family using html </p> <p style =" font-size:200%; " > font size using html </p> <p style =" text-align:center; " > text align center using html </p> </body> </html>