0

CSS and HTML wont link up

Right so I have coded my html and css files using Notepad. I have saved them as html.htm and css.css. They are in the same folder called blog. To link them i used this line of code: <link rel="stylesheet" type="text/css" href="css.css"/> The full content is: <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="css.css"/> <title>First Website</title> </head> <body> <section class="Header"> <header> <a href=""><img src="http://i.imgur.com/tWt2ZrX.jpg"/></a> </header> </section> <section class="Navbar"> <nav> <table> <tr> <td><a href="">About Me</a></td> <td><a href="">Funny stuff</a></td> <td><a href="">Home</a></td> <td><a href="">Cool Pictures</a></td> <td><a href="">Contact me</a></td> </tr> </table> </nav> </section> <section class="main"> <img src="http://www.secondapratica.com/wp-content/uploads/2016/02/Amsterdam-Summer.jpg"/> </section> </body> </html> .header img{ display:block; margin:0 auto; width:50%; padding:0 0 5px 0; } .navbar td{ text-align:center; width:10%; } .navbar a:link{ color:gray; text-decoration:none; } .navbar a:visited{ color:gray; text-decoration:none; } .navbar a:hover{ color:purple; font-weight:bolder; } .navbar nav{ width:95%; display:block; margin:0 auto; background-color:#cccccc; padding:10px; border:2px solid #999999; } .main img{ width:90%; display:block; margin:10px auto; padding:2px; border:4px solid #999999; }

10th Sep 2016, 11:48 AM
Adam Graham
Adam Graham - avatar
7 Réponses
+ 3
I've tested your files, and the css is correctly applied. See the grey border around the bottom image? It has been added via css. Class names are case sensitive: class="header" class="navbar" This is probably why you thought that the css wasn't applied. You can use local images by the way.
10th Sep 2016, 12:05 PM
Zen
Zen - avatar
+ 1
If they are in the same folder, put href="css.css".
10th Sep 2016, 11:16 AM
Zen
Zen - avatar
+ 1
What's the content of your files?
10th Sep 2016, 11:25 AM
Zen
Zen - avatar
0
Yep done that still not working though
10th Sep 2016, 11:20 AM
Adam Graham
Adam Graham - avatar
0
If "They are in the same folder called blog" means why you need to mention href="blog/css.css". Just use href="css.css"
10th Sep 2016, 11:40 AM
Vignesh Chinnaiyan
Vignesh Chinnaiyan - avatar
0
Ok have changed link href to "css.css" and have posted full code above. Hope this helps :)
10th Sep 2016, 11:49 AM
Adam Graham
Adam Graham - avatar
0
Thanks a million Zen big help
10th Sep 2016, 12:11 PM
Adam Graham
Adam Graham - avatar