smuggledPancakes
smuggledPancakes

Reputation: 10323

Using script tag to include JavaScript in program via a CSS file?

I have never seen this before. I have always included JavaScript in my HTML files. Is this jsfiddle doing it wrong or am I naïve?

http://jsfiddle.net/relly/jjwwd4mq/

CSS file in jsfiddle:

</style> <!-- remove this, it is just for jsfiddle --> 
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/angular-ui/bower-ui-grid/master/ui-grid.min.css"> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-touch.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script> 
<script src="https://cdn.rawgit.com/angular-ui/bower-ui-grid/master/ui-grid.min.js"></script> 
<style>
.grid {
  width: 500px;
  height: 250px;
}

I have trouble googling the issue of using a <script> tag in a CSS file, it gets conflated with other issues like executing JavaScript in a CSS file.

Also, what part should be removed? Just the top line? I am baffled by the </style> followed later by another <style>...

Upvotes: 2

Views: 93

Answers (1)

timolawl
timolawl

Reputation: 5564

Apparently jsfiddle implements their CSS/JavaScript sections simply using <style></style> and <script></script> tags inside an HTML file.

Upvotes: 3

Related Questions