The link tag is failing to load the external CSS file

Starting a fresh project using Angular and encountering an issue. When attempting to load an external CSS file with <link>, it fails to work. However, using an internal style with @import does work!

Not working with :

<link rel="stylesheet" type="text/css" src="transmission.min.css">

Working with :

<style>@import url('transmission.min.css');</style>

Both my CSS and JS files are concatenated and minified with grunt. Even without this process, the result remains the same.

The CSS and JS files are located in the same directory as the root of the app :

/
/index.html
/transmission.min.css
/transmission.min.js

Here's a snippet of my index.html file :

<!doctype html>
<html>
<head>
    <title>Transmission</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" src="transmission.min.css">
    <style>
        @import url('transmission.min.css');
    </style>

    <base href="/">
</head>
<body ng-app="transmission">

    <div ng-view=""></div>

    <script src="transmission.min.js"></script>
</body>

The CSS file consists of body{background-color: red;}

I've scrutinized my nginx configuration thoroughly and everything appears to be functioning correctly.

Even when checked with the Safari inspector, the CSS file at

http://transmission.dev/transmission.min.css
can be accessed but does not appear in the resources tab.

https://i.sstatic.net/hSnz9.png

Furthermore, my Angular application loads perfectly.

Any insights or solutions would be greatly appreciated! :-D

Thank you

Answer №1

anchor element utilizes the href attribute instead of the src attribute as indicated. Kindly update and verify.

Answer №2

Make sure to use

<link rel="stylesheet" type="text/css" href="transmission.min.css">

The link element requires the attribute href instead of src

Trust this information proves beneficial!

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

ng-class in AngularJS not interacting with Scope method

I am in the process of creating a new application. Here is how my index.html file looks: <html ng-app='myApp'> <body ng-controller='mainController'> <div ng-view> </div> </body> </html> My m ...

How can I position two divs side by side within an Appbar?

I would like the entire Container to be in a single row, with the Typography centered as it already is, and the toggle-container to float to the right <AppBar className={styles.AppBar}> <Toolbar> <Container> ...

"Although disabled, input elements can still be focused on in Firefox browser

Illustrative example let userInput = document.createElement("input"); userInput.id = "user-input"; userInput.type = "number"; userInput.className = "user-number-input"; userInput.disabled = true; document.body.appendChild(userInput); .number-inp ...

Ng-repeat seems to be having trouble showing the JSON data

Thank you in advance for any assistance. I have a factory in my application that utilizes a post method to retrieve data from a C# function. Despite successfully receiving the data and logging it to the console, I am facing difficulties in properly display ...

Combining Angular JS 1 and Laravel 5.2 for seamless integration

Currently, I am in the process of setting up Angular JS 1 with Laravel 5.2 by installing the necessary dependencies using npm. After installation, a node_modules folder was created alongside the app directory. My primary concern is whether it is recommend ...

Using the "this" keyword in JavaScript to access the "rel"

Take a look at the JSFIDDLE , where you will notice that the rel attribute in the alert is shown as 'undefined' : var ItemTypeArray = $('input[name^=ItemType]:checked').map(function(){ alert(this.id + ' , r= ' + this.rel) ...

What methods do publications use to manage HTML5 banner advertisements?

We are working on creating animated ads with 4 distinct frames for online magazines. The magazines have strict size limits - one is 40k and the other is 50k. However, when I made an animated GIF in Photoshop under the size limit, the image quality suffered ...

Update the src attribute in an HTML document

I am looking to dynamically change the size of an image on an HTML page using a dropdown list. Here is my code: <html> <head> </head> <body> <select id="selectbox" name=""> <opti ...

One way to automatically create unique reference numbers is to generate a random number between 1 and 99 and append it to a date format, such as YYMMDD. For example,

I have a code that generates numbers like 030317-001 to 030317-010 in a list. How can I modify it so that the same sequence is generated with just one button click, without any repeats, up to a maximum of say 030317-099? <?php $x = date("dmy");// ...

What is the best way to limit angular-xeditable to accept only positive numbers?

This is my code snippet. I'm looking for an attribute that will only allow positive numbers to be entered. <td><span e-step="0.001" editable-number="myNumber" onaftersave="updateValue()">{{ myNumber }} </span></td> ...

The Angular Observable continues to show an array instead of a single string value

The project I am working on is a bit disorganized, so I will try to explain it as simply as possible. For context, the technologies being used include Angular, Spring, and Maven. However, I believe the only relevant part is Angular. My goal is to make a c ...

Shifting text upwards within a document

I'm struggling with CSS and bootstrap as I have limited knowledge in this area. I have multiple divs on a page that I want to align based on our old website design. The problem I'm facing is that one div is larger on the right, causing a lot of ...

Adjust the countdown variable within the Angular Timer

Currently utilizing the Angular Timer feature found at Experiencing difficulty updating the countdown variable within the timer. It seems like this is a common issue and despite trying various "solutions", nothing has seemed to work so far. I'm reluc ...

What is the best way to ensure that md-action buttons remain fixed at the bottom of an md-card?

Is there a way to ensure that buttons inside md-action always stay at the bottom of the outer md-card, maintaining a fixed position? http://codepen.io/ResilientJoe/pen/aNEzBp Even after setting layout-align="end end" as mentioned in this resour ...

I'm attempting to make this script function correctly when an image is loaded

Can anyone help me figure out how to make this script function on image load instead of onclick? I came across the script on stackoverflow, but it was originally set up for onclick. I want it to work for onload or .load HTML====== <div id="contai ...

Sorting and filtering data using AngularJS filter and orderBy inside a controller or factory

I am currently working with a factory that looks like this: app.factory("ModuleFactory", function (api, $http, $q, filterFilter) { var moduleList = []; var categoryList = []; var moduleTypeList = []; var academyModuleTypeList = []; var mostUsed = []; var ...

Incorrect data for minimal values within Google charts

Currently, I am utilizing a Google chart found at the following link: In my data set, I have significantly high values for the line chart and relatively low values for the bar chart. In order to make both types of data more easily readable, I would like t ...

Guide to generating dynamic arrays in JavaScript when a button is clicked

I am working on a JavaScript program where I dynamically generate buttons and div tags, as well as retrieve data from a local JSON file. My goal is to implement a new feature where clicking a button will create an array with the same name as the button, al ...

Utilize the "rel" attribute within the text currently being shown through Colorbox

Can the rel text be utilized in the current text shown by Colorbox? I have a collection of images categorized with rel="Project Name" <a href="gallery/IN01 _GSM1 450x582.jpg" rel="Project Name" title="Global Supplier Management brochure Cover" name ...

How to dynamically adjust font size using Javascript

Is there a way to adjust the font size of the left-column using JavaScript? <div id="left-column"> <a href="">1</a><br> <a href="">2</a><br> <a href="">3</a><br> <a href=""> ...