JoJo
JoJo

Reputation: 806

stylesheet in other directory with noscript

I am creating a website in HTML, and I face a problem.

I have a CSS folder, and I want to be able to access it from every directory

root:

/css  
   - /skel-noscript.css"    
   - /skel-noscript.css"
 
/js
   - init.js
   - skel.min.js
   - skel-panel.min.js
   - html5shiv.js

/Downloads
   -/Download.html
 
/Downloads.html

/index.html

...

Now I have trouble when I try to access the stylesheets in Downloads/Download.html

my <head> code:

<head>
    <title>TITLE</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
    <!--[if lte IE 8]><script src="../js/html5shiv.js"></script><![endif]-->
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="../js/skel.min.js"></script>
    <script src="../js/skel-panels.min.js"></script>
    <script src="../js/init.js"></script>
    <noscript>
        <link rel="stylesheet" href="../css/skel-noscript.css" />
        <link rel="stylesheet" href="../css/style.css" />
        <link rel="stylesheet" href="../css/style-desktop.css" />
    </noscript>
</head>

When I use this code, the stylesheets don't work. when I delete the <noscript> around the links to the stylesheets, they do work, but my website is totally messed up.

enter image description here

What is happening? When I use this code in the root directory, it works fine

Upvotes: 0

Views: 649

Answers (3)

Muhammad Saqib Bilal
Muhammad Saqib Bilal

Reputation: 29

css files are not being added from tags in this case, is for browsers that don't support js or if js is off. go to the "init.js" file(one that u attached just before the tag) in your js folder and check it... css is being added from their so change directory paths for css from there. regards

Upvotes: 1

Stealth
Stealth

Reputation: 43

I suggest you to create a file something like header.phtml and call all the files you need to render the template.

<head>
    <title>TITLE</title>
    <noscript>
        <link href"<?= $this->getCssPath(); ?>" rel="stylesheet" type=text/css />
    </noscript>
</head>

and greate a file where you create a class something like

<?php class MyTemplate {

public function getCssPath() {

return 'css/skel-noscript.css';
       }

}

Upvotes: 0

drumkruk
drumkruk

Reputation: 1126

Are you turning off the javascript when testing this? <noscript> is only activated when the visitor has no scripting enabled. If you want to be able to link the css files always you have to get rid of the tag.

Upvotes: 0

Related Questions