...

View Full Version : Help! Lost money: CSS web design for dummies



araah
06-10-2012, 12:53 AM
Hi guys just purchased the book mentioned in the title.
Basically im going through the example and my chosen text editor is sublime text 2. My problem is that this stupid book cost me 22.00 and it is wrong. Even the basics and foundations of the book is wrong, well i hope it isn't anyway.... thsi is where you guys come in. So it tell me to go though an example where if i type the following into my chosen text editor and save it as a htm then it should display the obvious that is stated....

This is the code:



<html>
<head>
<style>
h1 { font-size:16pt color:blue;}
</style>
</head>
<body>
<h1>this headline is blue and 16 pt.</h1>
</body>
</html>



When i did this the text was black and not in 16pt... then the next example i used was to paste this and save it as .htm so i did... the following code:




<html>
<head>
<style>
div.box {width: 300px; height: 200px; padding: 30px;
font: 46pt times new roman;}
</style>
</head>
<body>
<div class=”box” style=” filter:
progid:DXImageTransform.Microsoft.Alpha
(Opacity=100,
FinishOpacity=0, Style=1, StartX=0, FinishX=0, StartY=0,
FinishY=100)”>
Hey...you can modify opacity.</div>
</body>
</html>



and it did not display the text with its opacity adjusted from 0 to 100.

What the hell is going on this book is 2005 and is still being sold. Dont computer understand this code/ language anymore???

P.s. i also tried other text editors such as notepad and notepad++

Help would be appreciated.

thank you

araah
06-10-2012, 12:54 AM
sorry guys tried to make the code look better for your ease

JJackson
06-10-2012, 01:14 AM
In your first example, you didn't close the font-size style. It should look like this:


h1 { font-size:16pt; color:blue;}

araah
06-10-2012, 01:20 AM
yes that works... but why the hell doesnt an education book have this that is still in production for 22.00 why would it make mistake right from the very start???

this is actually very annoying

JJackson
06-10-2012, 01:22 AM
yes that works... but why the hell doesnt an education book have this that is still in production for 22.00 why would it make mistake right from the very start???

this is actually very annoying

I've actually never used a book so I wouldn't know a lot about them. But I personally find it easier to put your CSS inside its own file for cleanliness. Also, comparing your code to similar sites helps a whole lot in identifying mistakes.

araah
06-10-2012, 01:25 AM
I've actually never used a book so I wouldn't know a lot about them. But I personally find it easier to put your CSS inside its own file for cleanliness. Also, comparing your code to similar sites helps a whole lot in identifying mistakes.

could you tell me how to link a style sheet to the htm file? Do i have to keep referring back to the css file everytime i use a variable?

JJackson
06-10-2012, 01:38 AM
could you tell me how to link a style sheet to the htm file? Do i have to keep referring back to the css file everytime i use a variable?

Just create a separate file called style.css (css would be the extension you can choose from the filetype when saving) and put this in the <head> tags of your index.html:

<link rel="stylesheet" type="text/css" href="style.css" />

You won't have to keep referring to it.

VIPStephan
06-10-2012, 01:41 AM
On a side note: The first line in an HTML document should always be the document type declaration. You don’t yet have to understand what exactly that does, suffice it to say that it should always be there and always the first thing in your document. Below is an example for linking external stylesheets (and using a doctype):


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="example.css" media="screen">
</head>
<body>
<h1>this headline is blue and 16 pt.</h1>
</body>
</html>

The file path to the stylesheet assumes the file on the same level in the hierarchy as the HTML file.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum