Hi,
I am new to html and css and currently learning using Head first HTML with CSS and XHTML to study.
This book so far is a great book but i am having trouble with one of the examples that they have given. I have gone over this about 10 times and cant see anything wrong with the code but my page just wont change background colour. I am using IE8 and below is the code if someone can tell me waht i am doing wrong.
Code:
<html>
<head>
<title> Starbuzz Coffee </title>
<style type="text/css">
body {
background-colour: yellow;
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 Beverages </h1>
<h2> House Blend, $1.49 </h2>
<p>
A smooth, mild blend of coffees from Mexico, Bolivia and Guatemala.
</p>
<h2> Mocha Cafe Latte, $2.35 </h2>
<p>
Espresso, steamed milk and chocolate syrup.
</p>
<h2> Cappucinno, $1.89 </h2>
<p>
A mixture of espresso, steamed milk and foam.
</p>
<h2> Chai Tea, $1.85 </h2>
<p>
A spicy drink made with black tea, spices, milk and honey.
</p>
</body>
<html>
Any help would be greatly appreciated.
Thanks, Jase.
Last edited by Kor; 11-24-2011 at 06:49 AM.
Reason: wrap the code [code][/code]
You must be one of Her Majesty's subject, I presume Unfortunately, at least for you, in almost all the programming languages it is used the American spelling, not the British one.
Same with grey(British)/gray(American), centre(British)/center(American), metre(in British English is the unit)/meter(in British E. is the device for measuring, while in American E. means both the unit and the device)
Thanks for your reply, i kicked my self when i saw the error. Just one more thing, i have also noticed that the gray (not grey) border has not appeared either. Is this another silly mistake i have missed? Not sure why i can't see it.
Thanks, i did find the problem that was causing the border not to appear. I will post this below.
The answer is pretty simple actually. In later chapters you'll figure out that a document type is needed to tell the browser which version of HTML you used to create your web page.
So by using this doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Your saying that your web page is using HTML version 4.01. With out telling the browser this your basically telling it to revert back to the dark ages (default HTML).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Your saying that your web page is using HTML version 4.01. With out telling the browser this your basically telling it to revert back to the dark ages (default HTML).
No. It is not the "dark ages". HTML4.01 is as good as XHTML or HTML5. It depends only on what do you want to do on your site. In fact HTML5 allows both HTML4.01 strict or XHTML strict syntax, on will.
Bookmarks