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??
-
You're right, that a good practice to split : * HTML is what I want to show * CSS is how I want to show it * Javascript is how I interact with itPierre-Olivier Vares– Pierre-Olivier Vares2016-05-04 10:26:58 +00:00Commented May 4, 2016 at 10:26
-
Refer w3schools.com/html/html_css.aspSatinder singh– Satinder singh2016-05-04 10:31:18 +00:00Commented May 4, 2016 at 10:31
Add a comment
|
2 Answers
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.