Student new to CSS having problems getting CSS to show up in web browser

Apr 17, 2008
170
1
81
I'm on my very first lesson with CSS. I'm using the book titled "Head First HTML with CSS & XHTML." I completed the first HTML lessons successfully. I type the HTML onto Notepad and it comes out fine.

The problem is when I modify the same document with CSS (in order to get margins, background-color, etc) the modifications to CSS are not recognized by my web browser.

I made two attempts and both attempts failed. The first attempt was made when I typed the CSS in. The second attempt was made when I copied the CSS straight out of the text book. I then pasted it to Notepad. I then closed it. I then hit my refresh button. But the CSS portion is not recognized/read by IE8. Is there a setting I'm supposed to set in my web browser? Below is the super simple CSS lesson that my browser for some reason fails to recognize:


<html>

<head>
<title>Starbuzz Coffee’s Mission</title>
<style type=”text/css”>
body
{
background-color: #d2b48c;
margin-left: 20%;
margin-right: 20%;
border: 1px dotted gray;
padding: 10px 10px 10px 10px;
font-family: sans-serif;
}
</style>
</head>

<body>
<h1>Starbuzz Coffee’s Mission</h1>
<p>To provide all the caffeine that you need to power your life.</p>
<p>Just drink it.</p>
</body>

</html>
 
Apr 17, 2008
170
1
81
there's no doctype.

Sorry, but not having a doctype is not the problem. The problem is related to something else. It's not the problem because

1) On page 30 of "Head First HTML", where this lesson is given, they don't show a doctype

2) They, the authors, don't discuss doctype yet

3) The HTML portion is read by Internet Explorer (no problem) - but not the CSS portion (that's the mystery) - all without a doctype

Below is the EXACT format the authors are using copied straight from the book and as you can see there is no doctype and note that the authors state that the CSS in this example, when typed onto Notepad, will (or should) be recognized in Internet Explorer:

<html>
<head>
<title>Starbuzz Coffee&#8217;s Mission</title>
<style type=&#8221;text/css&#8221;>
body {
background-color: #d2b48c;
margin-left: 20&#37;;
margin-right: 20%;
border: 1px dotted gray;
padding: 10px 10px 10px 10px;
font-family: sans-serif;
}
</style>
</head>
<body>
<h1>Starbuzz Coffee&#8217;s Mission</h1>
<p>To provide all the caffeine that you need to power your life.</p>
<p>Just drink it.</p>
</body>
</html>
 
Last edited:

Snapster

Diamond Member
Oct 14, 2001
3,917
0
0
This looks like it's been copied in and out of a word processor, try:

<style type="text/css">

instead of

<style type=”text/css”>

Speach marks are a different character from a quote so the tag is being ignored.
 
Apr 17, 2008
170
1
81
This looks like it's been copied in and out of a word processor, try:

<style type="text/css">

instead of

<style type=&#8221;text/css&#8221;>

What difference is there between the two, I don't see any structural difference. Please explain your example.
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
&#8221; is not "

They are two different characters. See the slant on the first? The second is valid, the former is not.

Don't edit html in Word. It does things like replace the " character with &#8221; to make it look nicer, but they are not the same thing at all as far as html is concerned.
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,284
3,905
75
1. Get Notepad++.
2. Replace all '&#8221;' with '"'. Copy and paste those characters into the search/replace boxes.
3. Don't use anything except a dedicated IDE, Notepad++, or Notepad to edit these files in the future.
 
Apr 17, 2008
170
1
81
” is not "

They are two different characters. See the slant on the first? The second is valid, the former is not.

Don't edit html in Word. It does things like replace the " character with ” to make it look nicer, but they are not the same thing at all as far as html is concerned.



Yesterday I thought Snapster was fooling around and trying to act like a comedian or a jerk (due to the answer Snapster gave me) or maybe he/she was under the influence of a drink or drug, which is a plausible scenario anywhere you go. So this morning I woke up at 3am, read the rest of this thread including your post. I then went back and made the changes you and Snapster recommended and to my surprise the changes worked. Meaning, with those changes my browser now recognizes the CSS example I was working on, the same example that was kicking my butt and driving me nuts. Oh happy day! You guys helped me out immensely. Thank you for your service to mankind
 

Ghostab94

Junior Member
Jun 9, 2013
1
0
0
Snapster I had the same problem and i was banging my head . Thanks to you.

PS Look at the code carefully lol
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |