Navigating through directories in an HTML file

In my directory, the folders are named in uppercase letters and have the following structure:

ONLINESHOP
    |-- index.html
    |-- COMPONENTS
    |-- CONFIG
    |-- TEMPLATES
        |-- CSS
            |-- main-style.css
    |-- CONTROLLERS
    |-- MODELS
    |-- VIEWS
       ...
       |-- USER
           |-- login.html

The main folder is OnlineShop. My goal is to access main-style.css from login.html

This method works:

<link rel="stylesheet" type="text/css" href="/OnlineShop/templates/css/main-style.css">

However, this approach does not work:

<link rel="stylesheet" type="text/css" href="/templates/css/main-style.css">

I wonder why the latter code fails to work. Shouldn't / lead me to the root directory (OnlineShop)?

Answer №1

The exact location of the web application root varies depending on your server setup.

If needed, you have the option to utilize the following code instead:

<link rel="stylesheet" type="text/css" href="../../templates/css/main-style.css">

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What steps can I take to prevent constantly re-fetching a disabled CSS file?

I'm currently in the process of implementing a dark theme on my website, and my current method involves using 2 style sheets: <link rel="stylesheet" type="text/css" href="/flatly.css"> <link rel="stylesheet& ...

What is the process of providing a thumbnail image to external websites?

When a user shares a link from a website on social media platforms like Reddit or Facebook, an image is usually attached to it. Is there a way to specify which image should appear in the header of the HTML file? I assume that there must be a meta tag, lik ...

Assigning a value and specifying the selected attribute for an options tag

Trying to understand the challenge of setting both a value and a selected attribute on an options tag. Each one works independently, but not together. For example: <select> <option *ngFor="let item of items" selected [ngValue]="item"> ...

Is there a way to adjust paragraph sizes in CSS flexbox so they scale with the font size?

After spending hours trying to figure this out on my own, I finally caved and registered on StackOverflow. Despite Google providing plenty of related questions and examples, I still can't find a solution to my specific problem. The issue at hand is c ...

Tips for assigning a class to an Angular accordion header when the panel is in the open state

I am currently utilizing the Angular UI Bootstrap accordion feature, which can be found here. <div ng-controller="AccordionDemoCtrl"> <div accordion close-others="oneAtATime"> <div accordion-group heading ...

Resizing an HTML table causes the background to break

I have incorporated a tailwind table with a max-width setting. In my html, I am utilizing the default Laravel Jetstream layout. However, I am facing an issue wherein the background doesn't repeat in the browser when trying to use the scrollbar on sma ...

Disable and grey out the button while waiting for the Observable to broadcast successfully

component.html <button mat-raised-button color="primary" type="submit"> <mat-icon>account_box</mat-icon> <span *ngIf="!loading">&nbsp;&nbsp;&nbsp;Register</span> <span * ...

How to use Nokogiri to efficiently extract targeted nodes from HTML

In my Ruby script, I am trying to extract specific values from an HTML document using the Nokogiri gem. The HTML content I'm parsing includes information about a user and their registered device. #!/usr/bin/ruby require 'Nokogiri' doc = No ...

Guide to dynamically implementing pagination through AJAX calls

In this javascript code snippet, I have a class named PurchaseHistory. var baseUrl = null; var parameters = null; var currentPageNumber = null; var TotalPages = null; var PageSize = null; $(document).ready(function () { baseUrl = "http://localhost/AP ...

What is the best way to choose the initial p tag from an HTML document encoded as a string?

When retrieving data from a headless CMS, the content is often returned as a string format like this: <div> <p>1st p tag</p> <p>2nd p tag</p> </div> To target and select the first paragraph tag (p), you can extract ...

Show specific content based on which button is selected in HTML

I am working on a project where I have three buttons in HTML - orders, products, and supplier. The goal is to display different content based on which button the user clicks: orders, products, or supplier information. function showData(parameter){ i ...

Extract from Document File

After receiving a PDF through an Angular Http request from an external API with Content Type: application/pdf, I need to convert it into a Blob object. However, the conventional methods like let blobFile = new Blob(result) or let blobFile = new Blob([resul ...

Is there a way to automatically increase the input id when adding a new row?

I have been working on dynamically adding new inputs and trying to assign a new ID that increments by 1 each time I add a new input. However, I am facing an issue where the value is not incrementing as expected. Can someone please help me identify what&apo ...

Tips for automatically disabling cloudzoom based on image width

I'm currently utilizing cloudzoom with the given markup: <div id="container"> <img id="main-image" class="cloudzoom" src="/img/image1.jpg" data-cloudzoom="variableMagnification: false, zoomOffsetX: 0, zoomPosition: 'inside', zoom ...

Display the specified div element automatically

Despite my best efforts, I can't seem to figure this out. I've searched everywhere for a solution but no luck so far. Is there a way to automatically display the content from http://tympanus.net/Tutorials/CSS3ContentNavigator/index.html#slide-mai ...

trouble displaying strength of passwords in AngularJS

Recently, I've delved into the world of angular js and have been working on a new directive to showcase the strength of passwords. If you'd like to see what I've done so far, check out this fiddle - https://jsfiddle.net/user_123/3hruj8ce/12 ...

Tips for determining what elements are being updated in terms of style

I need assistance with modifying the functionality of a webpage's dropdown menu. Currently, it displays when the mouse hovers over it, but I want to change it to appear on click using my own JavaScript. Despite setting the onmouseout and onmouseover e ...

JQuery Mobile Listview Filter Not Working: Troubleshooting Tips

Recently diving into the world of jquery mobile, I've managed to successfully create a homepage and a sub-page labeled "bible_studies," complete with a dynamic list generated through AJAX. Everything seems to be functioning perfectly except for one i ...

Ensure the table body scrolls the full height of the page while maintaining a fixed header when the table is out of view

My goal is to implement scroll bars for overflowed content within a single table on the page. Despite reading numerous posts on this topic and experimenting with various methods like setting height to 100% or using flex layout, I still can't seem to a ...

What is the best way to keep a header row in place while scrolling?

I am looking to keep the "top" row of the header fixed or stuck during page scrolling, while excluding the middle and bottom rows. I have already created a separate class for the top row in my header code: view image description ...