www.webdeveloper.com
Results 1 to 7 of 7

Thread: New to HTML and CSS

  1. #1
    Join Date
    Nov 2011
    Posts
    3

    New to HTML and CSS

    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&#37;;
    			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 07:49 AM. Reason: wrap the code [code][/code]

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    it is:

    background-color

    not
    background-colour

    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)

    And so on...
    Last edited by Kor; 11-24-2011 at 08:13 AM.

  3. #3
    Join Date
    Nov 2011
    Posts
    3
    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,

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Use rather colors values in hexa (for instance one of the gray nuances can be '#ccc') or rgb

    Set a real font family. Like: font-family:Arial, Helvetica, sans-serif;

  5. #5
    Join Date
    Nov 2011
    Posts
    3
    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).

    Thanks for your help.

  6. #6
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by jasona7791 View Post
    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).
    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.

  7. #7
    Join Date
    Nov 2011
    Posts
    2
    Ya I check this it work nicely but it don't show any color which you in css declaration. So what can I do for get color.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles