w3schools html css website code example

Example 1: CSS IN HTML

<!-- Styles can be inserted in html using <style></style> element -->
<style>
	body {
    	background-color: cyan/*Color*/; 
  	}
</style>

<!--CSS can also be linked using link tag in html 
-the link tag is a self-closing tag-->

<link rel="stylesheet" type="text/css" href="filename.css"/>

Example 2: CSS IN HTML

<!-- There are 3 ways to do this-->

<!-- #1: Inline CSS-->
<h1 style="color: red;">Red Heading</h1>

<!-- #2 Element CSS-->
<style>
  h1 {
    color: red;
  }
</style>
<h1>Red Heading</h1>

<!-- #3 Stylesheet CSS-->
<link rel="stylesheet" href="[stylesheet link]">

Example 3: use w3 css on your website

To use w3-css on your project just add the following cdn to your HTML head tag
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
from here you'll be able to call any w3-css class and use it in your project.

Tags:

Css Example