External CSS

Advertisements

Prev Tutorial Next Tutorial

External Style Sheet

An external style sheet is ideal or useful when the same style is applied to many pages. With an external style sheet, we can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section:

<link> tag

The <link> tag defines the relationship between a html document and an external resource. The <link> tag is mostly used to link style sheets file to html pages.

Syntax

<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
</html>

An external style sheet can be written in any text editor like notepad, edit plus etc. The file should not contain any html tags. Your style sheet should be saved with a .css extension. An example of a style sheet file is shown below:

Example

<style>
h1
{
color:red;
}
p
{
margin-left:20px;
color:yellow;
}
body
{
background-color:#000;
}
</style>

Example of External CSS

First we write html page and save it with .html extension.

Example

<html>
<head>
<!-- Here we import css file using <ink> tag -->
<link rel="stylesheet" type="text/css" href="mystyle.css">
<h1>This is heading</h1>
<p>This is paragraph</p>
</head>
</html>

Again we write a css page and save it with .css extension. In the above code mystyle is css file name. Below is our css code.

Example

<style>
h1
{
color:red;
}
p
{
margin-left:20px;
color:yellow;
}
body
{
background-color:#000;
}
</style>

Result

This is heading

This is paragraph

External CSS

In the above image we use same css (style.css) file for all the pages (index.html, About.html, help.html, contact.html)

External CSS

Watch this Video


Prev Tutorial Next Tutorial

Advertisements

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

Download Projects

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements