Embed CSS in HTML

Already made a CSS stylesheet? However you don't know what to do with it? This article will show you how.

Steps

  1. Decide if you have a stylesheet on a different file or if you are embedding it on the html document.
  2. If you are embedding it on the html document, then all you need is the index html page. You can then add the CSS code to the top of the page and link it to where you need it.
  3. However, if you have all the CSS code on another file, which should have the .css extension, then you need to add some code inside the head tags at the top of the html page.
    1. <link rel="stylesheet" type="text/css" href="CSSFILENAME.css">
    2. Be sure to replace 'CSSFILENAME' with the name of your stylesheet.(Also remember to add .css)
  4. After you are done you can just check your index html page if changes are applied when editing your CSS file.



Tips

  • Be sure to always change the CSS file when adding new text formats to the html document.
  • Always remember to have the CSS stylesheet as the extension .css

Related Articles

You may like