Three ways To Insert A Style sheet in Html

admin_img Posted By Bajarangi soft , Posted On 29-09-2020

When a browser reads a style sheet, it will format the HTML document according to the information in the style sheet,There are three ways of inserting a style sheet: External CSS=With an external style sheet, you can change the look of an entire website by changing just one file,Internal CSS=An internal style sheet may be used if one single HTML page has a unique style.,Inline CSS=An inline style may be used to apply a unique style for a single element.

Stylesheet

1.Insert a External Style sheet

<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="mystyle.css">
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>
2.Add this Css Link to Html file

<link rel="stylesheet" href="css/mystyle.css">

3.If you are Creating External Style sheet Need create style sheet add this Link To Html File
style.css

body {
  background-color: lightblue;
}

h1 {
  color: navy;
  margin-left: 20px;
}

 

4.Insert a Internal Css
<!DOCTYPE html>
<html>
<head>
    <style>
        body {
            background-color: linen;
        }

        h1 {
            color: maroon;
            margin-left: 40px;
        }
    </style>
</head>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>
5.Inset a Inline Css
 
<!DOCTYPE html>
<html>
<body>

<h1 style="color:blue;text-align:center;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>

</body>
</html>

 

Related Post