html css basic website code example

Example 1: make a website with html and css

You can begin by learning the basic elements of HTML, like <div>,<p> and <span>.
 
Then with the elements' ids and classes, you can practice some css by creating
a <style></style> element in your .html file.
Example:
  <html>
    <style>
    	#myDiv{
      		color:red;
      	}
    </style>
    <div id='myDiv'>
      Hello World
    </div>
    
  </html>

Example 2: basic css

<html>
<head>
<title>TAG index</title>

<style type="text/css">

.example a:link { color: #0000ff; }
.example a:visited { color: #0000a0; }
.example a:hover { color: #ff0000; }
.example a:active { color: #ffff00; }

</style>

</head>
<body>

<ul class="example">
<li><a href="../../index.html">The styles are applied to this link.</a></li>
<li><a href="../index.html">The styles are applied to this link.</a></li>
<li><a href="index.html">The styles are applied to this link.</a></li>
</ul>

<ul>
<li><a href="../../index.html">The styles are not applied to this link.</a></li>
<li><a href="../index.html">The styles are not applied to this link.</a></li>
<li><a href="index.html">The styles are not applied to this link.</a></li>
</ul>

</body>
</html>

Tags:

Misc Example