...

View Full Version : Divs aren't working for me... What did I do wrong? I'm new at this.



jamman0411
02-13-2011, 06:15 AM
HTML:
<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" type="text/css" href="floatandclear.css" />

<head>
<meta charset="utf-8">
<meta name="generator" content="CoffeeCup HTML Editor (www.coffeecup.com)">
<meta name="created" content="Sun, 13 Feb 2011 01:40:07 GMT">
<meta name="description" content="">
<meta name="keywords" content="">
<title>Three Column Liquid Layout</title>

<!--[if IE]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div id=”header”>Header</div>
<div id=”leftcolumn”>Left column</div>
<div id=”rightcolumn”>Right column</div>
<div id=”bodytext”>Main page text goes here.</div>
<div id=”footer”>Footer</div>

</body>
</html>



------CSS------
/* Default CSS */

body {
margin: 0px;
padding: 0px;
}

#header {
width: 100%;
background-color: #CCCCCC;
}

#footer {
width: 100%;
clear: both;
background-color: #CCCCCC;
}

#leftcolumn {
float: left;
width: 20%;
height: 600px;
background-color: #999999;
}

#rightcolumn {
float: right;
width: 20%;
height: 600px;
background-color: #999999;
}

#bodytext {
float: left;
background: #fff;
width: 60%;
height: 600px;
}

Excavator
02-13-2011, 09:04 AM
Hello jamman0411,
You have the link to your CSS in the wrong place, other than that it seems fine.
What is the problem?

jamman0411
02-13-2011, 05:27 PM
When I preview the html it just shows all the words inside the divs in a list... And the float and clear that I have in the css didn't move them. And I put background-color: black; in the body of the css and when i preview the html it's all black so that means they are linked right? Where is the link supposed to go? Thanks.

Excavator
02-13-2011, 05:55 PM
When I preview the html it just shows all the words inside the divs in a list... And the float and clear that I have in the css didn't move them. And I put background-color: black; in the body of the css and when i preview the html it's all black so that means they are linked right? Where is the link supposed to go? Thanks.

The link to your CSS belongs inside the head tags of your document. The code you quote in your first post has that link before the head starts.

Do you have some updated code so we can see your current issues?
Have you tried validating that code yet? That may clear up many of your problems.

jamman0411
02-13-2011, 06:01 PM
Ok thanks. I validated the css and html and they both passed... And in the preview it just shows the words in a list with no css at all... So I have no idea what I did wrong... But it's not working for me.. The code is the same as before besides I put the link inside the <head> tag. I'm just trying to get the divs to take effect before I move on..

Excavator
02-13-2011, 06:08 PM
And in the preview it just shows the words in a list with no css at all...

What are you using to preview this with? Have you tested this in a real browser (FireFox)?

jamman0411
02-13-2011, 06:10 PM
I'm using coffeecup html editor and also i can right-click and press preview in browser... I tested it in internet explorer and it's still in a list.. I also tried it in mozila firefox.

Excavator
02-13-2011, 06:15 PM
I'm using coffeecup html editor and also i can right-click and press preview in browser... I tested it in internet explorer and it's still in a list..

I guess I don't know what you mean by "in a list." Your code doesn't have any list, the only text is just the 2 or 3 words that describe each element.

Is there any chance you can put up a test site so we can see what you're seeing? A screencap could be posted here to show it too, but a test site would be better.

jamman0411
02-13-2011, 06:17 PM
All i see is this:

Header
Left column
Right column
Main page text goes here.
Footer

those words in the top-left corner of the screen... I'll set up a test site.

VIPStephan
02-13-2011, 06:19 PM
Is the path to the stylesheet correct?

jamman0411
02-13-2011, 06:38 PM
floatandclear.clanteam.com

I renamed the html file to index.html

Everything else is the same...

VIPStephan
02-13-2011, 06:47 PM
Ah, I see! Hah, that one is hard to spot, I admit. :)

You’ve used so called “smart quotes” for the attribute values which kinda doesn’t work obviously. So rather than:


<div id=”header”>

it must be

<div id="header">

Small difference, big impact.

jamman0411
02-13-2011, 06:50 PM
Wow... Thank you so much you just saved my day! I'm just starting to learn about web design and I was gettin really frustrated lol ahh thank you! : )



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum