How do I embed CSS in HTML?



How do I embed CSS in HTML?


==> internal css example

<!DOCTYPE html>

<html>

<head>

<style>

body {background-color:lightgray}

h1 {color:blue}

p {color:green}

</style>

</head>

<body>

<h1>This is a heading</h1>

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

</body>

</html>

==> external css example

If You need to link the file of CSS with the HTML file of yours. Use this command

<head>

<link rel="stylesheet" type="text/css" href="file.css">

</head>

If the file resides in some folder then you need to use like


<head>

<link rel="stylesheet" type="text/css" href="folder_name/file.css">

</head>


Post a Comment

0 Comments