+ 8

How can I link CSS with HTML?

1st Mar 2017, 8:45 AM
Mahmudul Hasan Fahim
Mahmudul Hasan Fahim - avatar
6 Answers
+ 5
Add this code to your html preferably in the head section: <link href="filename.css" rel="stylesheet">
1st Mar 2017, 9:44 AM
Chirag Bhansali
Chirag Bhansali - avatar
+ 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.
1st Mar 2017, 7:40 PM
Shehab Amr
Shehab Amr - avatar
+ 5
@Rahul: <link> doesn't have a closing tag
1st Mar 2017, 9:45 AM
Chirag Bhansali
Chirag Bhansali - avatar
+ 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 ! :-)
1st Mar 2017, 9:13 AM
Rahul Nishar
Rahul Nishar - avatar
+ 2
ensure that the CSS file is in the same folder as your HTML. or else use /.
1st Mar 2017, 10:48 AM
Andre Littiere
Andre Littiere - avatar
+ 2
By the help of link tag i.e. <link rel="stylesheet" type="text/css" href="filename.html"
22nd Mar 2017, 4:55 AM
Abhishek Arora
Abhishek Arora - avatar