CSS Basics
Different CSS Code to use in your websites
Most of the time when you are adding CSS into your code, you need to insert a style tag inside the head tag. Other parts of the CSS code will go in the body section.
Setting a Background Image for a webpage:
Types of Navigation Bars
Navigation Code for Horizontal Navigation Menu:
<!DOCTYPE html>
<html>
<head>
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
width: 200px;
background-color: #f1f1f1;
}
li a {
display: block;
color: #000;
padding: 8px 16px;
text-decoration: none;
}
li a.active {
background-color: #4CAF50;
color: white;
}
li a:hover:not(.active) {
background-color: #555;
color: white;
}
</style>
</head>
<body>
<h2>Vertical Navigation Bar</h2>
<p>In this example, we create an "active" class with a green background color and a white text. The class is added to the "Home" link.</p>
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#about">About</a></li>
</ul>
</body>
</html>
Note: The bold bits must exist in your webpage code!
Code for a Drop down Menu:
Creating an image gallery:
Making an image circular
Making an image have a polaroid effect:
Placing text into columns
Customizing the Icon displayed next to the Title
<link rel="icon" type="image/png"
href="http://image.flaticon.com/icons/png/512/11/11118.png" />
Place this code before the closing head tag. <replace text inside "" with the web address or file name and extention of the image you want to use. png files work the best.>