+ 5
Css
How can u link css to html without any errors?
4 Answers
+ 14
https://www.sololearn.com/learn/CSS/1079/ make sure you put css in same folder where is html, if you wont to put css in for example css file than writte ex. <link href="css/custom.css" >
+ 6
I prefer using external css.
Example
<head>
<link rel="stylesheet" href="style.css">
</head>
Also if the css in a directory
Ensure u specify the path
<link rel="stylesheet" href="directory/style.css">
+ 6
⏩⏩⏩You can link css with html using link tag .
▶️ <link href= "css file name" or if it is in another folder the path of the file .
🔴🔴 use " / " separate the each directories.
▶️ then use rel attribute inside link tag rel=" stylesheet".
▶️ finally you should use type attribute type = "text/css".
✔I think you don't know basics of html and css you should firstl complete css & html tutorial.
🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽🔽
✅Then you can cleary know this happen.
Hope this will help you.
🌻🌼🌺💮🌸💐🌼🏵🌻
0
If we want to link css with html we can prefer three way
1. using link style rel ="stylesheet" its called external css. in external css u have to create 2 file one html and second CSS
2. inline css: <h1 style="color:red; font-size:50px;"> my first INLINE CSS</h1>
you can directly write the css code into html tag
3. in a third way guys you can use internal css : using <style>which is must be write in <head> tag
if we compare the three way the must easier way is external CSS
Because The advantage of external stylesheets is that it can be created once and the rules applied to multiple web pages. it increase the code reusability
css file
body{
background-color:skyblue;
}
h1{
color:green;
font-size:50px;
}
p{
color:blue;
}
HTML file
<html>
<head>
<link style rel="stylesheet" type="text/css" href="external.css">
</head>
<body>
<h1> MY First EXTERNAL CSS</h1>
<p> this is a first css web page using external css</p>
</body>
</html>