+ 8
How can I link CSS with HTML?
6 Answers
+ 5
Add this code to your html preferably in the head section:
<link href="filename.css" rel="stylesheet">
+ 10
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p id="css">link css with html</p>
</body>
<style>
#css{
}
</style>
</html>
you need to put id in your tag in html and rename it as you like but (don't start id with any number)and in css field you need to put # before your id that you write in html.
+ 5
@Rahul: <link> doesn't have a closing tag
+ 3
you can link CSS with HTML by using <link> tag in the head of the HTML file
eg :
<html>
<head>
<link rel="stylesheet" href="filename.css"></link>
</head>
<body>...</body>
</html>
hope u like this ! :-)
+ 2
ensure that the CSS file is in the same folder as your HTML. or else use /.
+ 2
By the help of link tag i.e.
<link rel="stylesheet" type="text/css" href="filename.html"