How do I keep my css from showing up in my source code?

Question by dcpumpfake: How do I keep my css from showing up in my source code?
My website has all of my css styles listed towards the top of my code. I never see css in anyone else’s sites. Do you set the css styles up in a separate document and reference them in your code? if so how? or am I way off here?


Best answer:

Answer by mdigitale

Give your answer to this question below!


  1. They import an external css document.

    For example:

    – Put your css in a document called ‘style.css’ and upload it in the same dir as the page that needs it.
    – Add this in the section of your html, instead of the actual css style you have there now:

    If you open the page now, it’ll load the external css file and apply it. The added bonus is that you can use that same css file for other pages as well, so no need to copy/paste the style code to every html document.

    Note that the style.css file does not require the

  2. Jordan G says:

    It’s really simple. Save your CSS file in a separate document, and then you have two ways of linking it to the document:

    Or alternatively:

    Both are essentially the same, it’s entirely up to you which one you prefer.

    Edited to add: exch’s answer is very good, and I’d rate it up if I could; it explains two additional things that you might be confused about, i.e. that you should put the code linking to the stylesheet in your head, and that you don’t use any

Speak Your Mind



WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera