+ 2

I can't link a .css to html

I want to link my css stylesheet to my html document, but it never works. Here is the code. <!DOCTYPE html> <html> <head> <link href="better.css" rel="stylesheet" type="text/css"> <title>Something</title> </head> <body> <h1>blah blah</h1> <ul> <li><a href="Menu.html">Menu</a></li> <li><a href="Download.html">Download</a></li> <li><a href="Help">Help</a></li> </ul> <p>It is:</p> <ul> <li>Reliable</li> <li>Cheap</li> <li>Fast</li> <li>And Helpful</li> </body> </html> The css file is in the same file as the html. This is my css file that I can't see in inspect element, it says it couldn't be loaded. body { background: #999; } h1 { text-decoration: underline; }

26th May 2018, 6:11 AM
Shane
Shane - avatar
1 ответ
+ 3
You're trying this on your device, or on sololearn? Because: in sololearn you need to specify the full path to the file. Example http://website.me/mobile.css If it's in your device, by specifying just the name of the file, you're saying that the file is in the same folder than the html you're executing
26th May 2018, 6:17 AM
voidneo