0

Put this line in my html and that css file is in the same directory. It is having no effect on my webpage. It's like it's not even there: . I tried trouble shooting as follows: I put my 2 files in their own directory and redid them in Wordpad. Again the HTML worked fine but the css file obviously didn't link in as none of the directed formatting was executed. I tried making a 2 nd bare bones css file and again it was not linked in. I tried changes the link address to include directory tree right back to root. Do tags have to be used in these CSS files ? Mine just starts with a tag followed by formatting commands.

body {
font-size:12pt;
font-family:Verdana, Geneva, Arial, Helvetica, sans-serif; /* picks first font in list order*/
color:brown;
line-height:14pt;
padding-left:5pt;
padding-right:5pt;
padding-top:5pt;

}

h1{ font:14pt Verdana, Geneva, arial, Helvetica, sans-serif; font-weight:bold; line-height: 20pt; }

subheader { font-weight:bold; color:#593d87; }

img{ padding:3pt; float:right; }

a { text-decoration:none; }

a:link, a:visited { color:#8094d6; }

a:hover, a:active { color:#FF9933; }

footer { font-size: 9pt; font-style:italic; line-height:12pt; text-align:center; padding-top:30pt; }

9
  • "Wordpad" gave me the shivers. Not exactly the editor for code. Are those files served as static content, from the same directory? How do you link the CSS in your HTML file? Does the CSS file show up in the browser's dev tools (F12) if you open the HTML page? – Blauelf Jul 4 '19 at 7:25
  • <!DOCTYPE html> <html lang = "en"> <head> <title> <link rel="stylesheet" href="~/environment/pset5/homepage/stylesheet1.css" > Cholly Mo's World </title> </head> – Joe Gancher Jul 4 '19 at 9:08
  • My first attempts did not use the path : <title> <link rel="stylesheet" href="stylesheet1.css" > – Joe Gancher Jul 4 '19 at 9:13
  • Don't worry about Wordpad. If you save as plain text, it works fine. in any event that was just a last ditch effort at debugging to see if there was something wrong with the HTTP Server. – Joe Gancher Jul 4 '19 at 10:02
  • Yeah, I use Wordpad sometimes myself (because it can read unix-style line breaks, unlike Notepad on Windows NT 6.1), but it's certainly not designed as a code editor, and it's pretty easy to mess up, so after a few bad surprises, I use it for reading only. – Blauelf Jul 4 '19 at 11:02
0

BINGO.... got it to work, by simply repositioning the line between <head> and <title>. Strange though ... as I'd seen other references say it should go after the <title> tag.

1
  • Should be at some point after </title>, but before </head>. The way you had it, it was inside the title element, which won't work (or at least it's not supposed to work like that, browsers often try to "guess" what was meant, so much broken code out there). – Blauelf Jul 4 '19 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .