Question: > 
> **Possible Duplicate:**  
> 
> [Embedding extra styles with noscript](https://stackoverflow.com/questions/218162/embedding-extra-styles-with-noscript)  
> 
> [Define css if javascript is not enabled](https://stackoverflow.com/questions/4665748/define-css-if-javascript-is-not-enabled) 
> 
> 
> 

I am trying to define specific CSS styles only if Javascript is turned off. I am using:

```
<noscript>
    <style type="text/css">
    .needjs {display:none !important;}
    .mwnojs { margin-top: 40px !important; }
    </style>
</noscript>

```

When trying to validate the page source, I get the error "Element style not allowed as child of element noscript in this context".

So, how would I go about doing this while keeping my markup valid?

Answer: 
Seems very similar to this [question](https://stackoverflow.com/questions/218162/embedding-extra-styles-with-noscript)

> 
> "To clear up the validation issue: noscript is only allowed in the
>  body element, style only allowed in the head. Therefore, the latter is
>  not allowed within the former."
> 
> 
> 

It might matter where your `<noscript>` tag is located.
You can get around this by having those classes in your default stylesheet and have JavaScript get rid of them when the page loads. This will only work if JavaScript is enabled otherwise it would load the desired styles.