Css | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Css

How can u link css to html without any errors?

13th Apr 2019, 7:00 AM
ely
ely - avatar
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" >
13th Apr 2019, 7:05 AM
PanicS
PanicS - avatar
+ 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">
13th Apr 2019, 7:13 AM
washie mugo
washie mugo - avatar
+ 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. ๐ŸŒป๐ŸŒผ๐ŸŒบ๐Ÿ’ฎ๐ŸŒธ๐Ÿ’๐ŸŒผ๐Ÿต๐ŸŒป
14th Apr 2019, 5:11 PM
Nithya Yamasinghe
Nithya Yamasinghe - avatar
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>
8th Mar 2021, 8:56 AM
Ishan Shah
Ishan Shah - avatar