0

css link

when playing around with a code that has both html and css i was changing the color of the font with css. i got the color to change with link rel="stylesheet" and with link href="example.css" should i have both? is there a difference? and what is their relation to one another?

22nd Feb 2017, 6:20 PM
Melissa Harris
Melissa Harris - avatar
4 Respuestas
+ 5
please show your code. did you do something like this: <link rel="stylesheet"> <link href="example.css">
22nd Feb 2017, 6:43 PM
Mario L.
Mario L. - avatar
+ 3
the second code won't use your stylesheet, because you didn't tell which one. that's what href is for. use the example Raj Kumar Chauhan provided.
23rd Feb 2017, 10:10 PM
Mario L.
Mario L. - avatar
+ 1
<link rel="stylesheet" href="example.css"> if you are using HTML5, then you can drop rel attribute else use both. it should work fine.
22nd Feb 2017, 6:47 PM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
<html> <head> <link href="eample.css"> <title>Page Title</title> </head> <h2>hello</h2> <body> </body> </html> but this also works <!DOCTYPE html> <html> <head> <link rel="stylesheet"> <title>Page Title</title> </head> <h2>hello</h2> <body> </body> </html>
23rd Feb 2017, 9:42 PM
Melissa Harris
Melissa Harris - avatar