I have a file containing both html and css code.How it is possible to separate the html code in some files and css in some other files??
Yes. You can save the css in a .css
file. Then in your HTML head tags, you can do <link rel='stylesheet' href='yourcssfile.css'>
<html>
<head>
<link rel='stylesheet' type='text/css' href='yourcssfile.css'>
</head>
<body>
<p>Test</p>
</body>
</html>
In yourcssfile.css
p {
color:red;
}
This will make the paragraph text red and your CSS is within a different file.
Simply put the CSS code into a file.css
and include it in your HTML file.
<head>
<link rel="stylesheet" type="text/css" href="file.css">
</head>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With