w3 schools html css code example

Example 1: how to link css to html

<link rel="stylesheet" href="PathToYourFile.css">

Example 2: how to link your css file to html

<head>
	<link rel='stylesheet' href='style.css'>
</head>

Example 3: css in html

<!-- EXAMPLE -->
<div class="your_class" style="display:none">

<!--[SYNTAX: style="<CSS-code>"] -->

Example 4: 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]">

Tags:

Misc Example