0

Here is the HTML content of the page:

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
    <script src="js/less-1.3.0.min.js" type="text/javascript"></script>
    <link rel="stylesheet/less" type="text/css" href="style.less" >    
</head>

If I open up source in Google Chrome and open in a new tab to see the less javascript file, and the less stylesheet I wrote, I can see the contents, meaning they are linked correctly.

Why aren't my LESS styles being applied?

Edit: Even running this from WAMP to avoid the whole "file:///" problem, doesn't apply the styles.

Edit:

The contents of the .less file:

html, body {
    margin:0;
    padding:0;
}

#headbg {
    height:497px;
    background-color:red;
}

#header-wrapper {
    width:980px;
    margin-left:auto;
    margin-right:auto;
    overflow:hidden;
}

#header-wrapper #left-container {
    float:left;
    position:relative;
    outline:1px solid cyan;    
}

#logo {
    margin-left:10px;
    display:block;
}

#logo-hue {
    position:absolute;
    top:20px;
}

#social {
    float:left;
    color:#fff;
}

#social .message {
    text-align:center;
}

#social .contact {
    text-align:center;
}

#header-wrapper #carusel-container {
    float:left;
    outline:1px solid cyan;
}

#bodybg {
    background-color:#fff;
}
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257

2 Answers2

2

Put the stylesheet reference above any others.

<head>
    <link rel="stylesheet/less" type="text/css" href="style.less" >    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
    <script src="js/less-1.3.0.min.js" type="text/javascript"></script>
</head>
RSM
  • 14,540
  • 34
  • 97
  • 144
0

Ryan's answer is right : however with Js and Css theory says Js will start working soon as loaded depends on which function is called. but when js script is running - the css is not yet loaded. so alwasy load css first so that js ( if they working straight e.g. document.ready() ) - they have all properties, styles available which they require.

And for the same reason you should include jquery file first ( if you are using it ) before trying any of their plugins.

Hope it helps

user769889
  • 376
  • 2
  • 12