Need some help with this website

Marinski

Golden Member
Apr 5, 2006
1,051
0
0
classicboxingfights.blogspot.com
Hey I was wondering if somebody can take a look at this and help me with it. This is my first website so my CSS knowledge is limited. Here is the website. Here is the Home page, don't bother clicking the links because there is nothing. Few things I'm trying to figure out. First I want to center the entire page in the middle of the screen. Also, I was wondering if there is a way that the right and left panels can become larger (up and down) and have the footer move down as I type more content in, opposed to having to adjust the heights of the panels and then moving the footer down. Another thing, It looks jacked up in IE but looks fine in Firefox. Can I get it to look the same in both?? Thanks.
 

Marinski

Golden Member
Apr 5, 2006
1,051
0
0
classicboxingfights.blogspot.com
Heres the CSS

body {
background-color: #ECECEC;
}

div.container {
position: relative;
}

div.header {
position: absolute;
width: 800px;
height: 120px;
background-color: white;
border-top: 2px solid #00aeed;
border-left: 2px solid #00aeed;
border-right: 2px solid #00aeed;
}

img.logo {
margin-top: 10px;
border: none;
}

div.topmenu {
position:absolute;
width: 800px;
top: 129px;
background-color: #00aeed;
border: 2px solid #00aeed;
text-align: center;
font-size: 12px;
font-family: Arial;
color: white;
}

div.left {
position: absolute;
width: 165px;
top: 146px;
height: 745px;
background-color: white;
border-left: 2px solid #00aeed;
}

div.right {
position: absolute;
width: 635px;
top: 146px;
left: 174px;
height: 745px;
background-color: white;
border-right: 2px solid #00aeed;
border-left: 1px dotted #00aeed;
}

div.footer {
position: absolute;
width: 800px;
top: 860px;
background-color: #00aeed;
border: 1px solid #00aeed;
text-align: center;
font-size: 12px;
font-family: Arial;
color: white;
}

a.menu:link {
color: white;
text-decoration: none;
}

a.menu:hover {
background: #959595;
}

a.menu:visted {
color: white;
}

ul.list {
font-family: Arial;
font-size: 14px;
list-style-type: disc;
margin-left: -5px;
}

a.leftlist:link {
color: #007fff;
}

div.right h4 {
text-align: center;
font-family: Arial;
color: #959595;
margin-top: 30px;
}

p.heading {
font-family: Arial;
font-size: 14px;
margin-left: 10px;
margin-top: 30px;
}

p.content {
font-family: Arial;
font-size: 12px;
margin-left: 10px;
margin-right: 10px;
}

span.gipic {
float: right;
padding: 10px;
text-align: center;
margin-left: 5px;
margin-bottom: 10px;
}

 

jw0ollard

Senior member
Jul 29, 2006
220
0
0
eek.

1) Get rid of any "position:absolute". That is definitely not the way you want to position your DIVs. That's also the reason your DIVs aren't expanding to fit the content inside.. or above/below it (among other things)
2) To center a page, simply attribute a width to the body (800px) and set the margin to "0px auto". Don't know how much CSS you know, so let me explain. "margin: 0px auto" is the short way of typing out "margin: 0px auto 0px auto" which would be "top - right - bottom - left", respectively. "Auto" on the left/right margins will always center the element, so long as the widths allow it and are defined.

Edit:

OK.. Try this. This isn't perfect, but it's a step in the right direction.

body {
background-color: #ECECEC;
width: 800px;
margin: 0px auto;
padding: 0px;
border: 2px solid #00aeed;
}

div.container {
}

div.header {
width: 800px;
height: 120px;
background-color: white;
}

img.logo {
margin-top: 10px;
border: none;
}

div.topmenu {
width: 800px;
background-color: #00aeed;
padding: 2px 0px 2px;
text-align: center;
font-size: 12px;
font-family: Arial;
color: white;
}

div.left {
float: left;
width: 165px;
padding: 0px;
background-color: white;
}

div.right {
float:right;
width: 634px;
padding: 0px;
background-color: white;
border-left: 1px dotted #00aeed;
}

div.footer {
width: 800px;
background-color: #00aeed;
padding: 2px 0px 2px;
text-align: center;
font-size: 12px;
font-family: Arial;
color: white;
}

a.menu:link {
color: white;
text-decoration: none;
}

a.menu:hover {
background: #959595;
}

a.menu:visted {
color: white;
}

ul.list {
font-family: Arial;
font-size: 14px;
list-style-type: disc;
margin-left: -5px;
}

a.leftlist:link {
color: #007fff;
}

div.right h4 {
text-align: center;
font-family: Arial;
color: #959595;
margin-top: 30px;
}

p.heading {
font-family: Arial;
font-size: 14px;
margin-left: 10px;
margin-top: 30px;
}

p.content {
font-family: Arial;
font-size: 12px;
margin-left: 10px;
margin-right: 10px;
}

span.gipic {
float: right;
padding: 10px;
text-align: center;
margin-left: 5px;
margin-bottom: 10px;
}


3) Now, for a lesson on "clearfix". Look it up. You need to implement it on sites with floated left/right content ALWAYS. In the midst of looking that up you should also find several other fixes that you should always do.. Like the IE box model hacks, and the IE/Mac fix.

4) The CSS I made probably isn't perfect. Looks fine in FF, but IE just might like the left/right float, and you'll see the div.right BELOW the div.left instead of next to it. This normally is because of how IE interprets padding, and its crappy box model, but since there is no padding on anything, you MAY be safe.

5) Notice I got rid of all the "border-top/left/right" around EVERY element, and instead just put the 2px border around the entire body. :)

6) Everything that's wrong with the HTML If you click "Tidy Source" in the Jump To menu, it'll take you down to the cleaned up source. If it messes up the page graphically, don't use it, but it might help you get rid of those 28 errors it found. :) You should always check your pages at W3C... It really helps you learn that tricky XHTML syntax, like making sure you self-close tags like META, IMG, and so on.

7) You should also really get rid of any "height" attributes on your div.left/right. (I've already removed them from the CSS above) What you're doing is forcing the content to be a certain height, so you can never add any content without fidgeting with the div height.

What you should do is let the divs set their own height, but you're going to run into ONE problem. The div.left sidebar isn't going to stay white all the way down the page.

Here's a simple fix: Create a 800px by 1px (width by height) WHITE gif and change the body selector to:

body {
background: #ECECEC url(path/to/white.gif) center center repeat-y;
width: 800px;
margin: 0px auto;
padding: 0px;
border: 2px solid #00aeed;
}

8) HTML fix:

Change: <div class="right">blahblah</div>
<div class="footer">blahblah</div>
</div> <!-- (the /div to the div.container) -->

To: <div class="right">blahblah</div>
</div>
<div style="clear:both"></div> <!-- (you don't need anything in the DIV -->
<div class="footer">blahblah</div>

Just to make sure the footer STAYS at the bottom. When I took away the sidebar height from the CSS, the footer decided to jump up right underneath where it says "Links". :)
 

Marinski

Golden Member
Apr 5, 2006
1,051
0
0
classicboxingfights.blogspot.com
Yes, thats exactly how I want it, thank you. Everything is good aside from the footer is right underneath the left panel but I'm putting more stuff on the left side so that should help it. I will try the fix for right now. This will be my fourth time redoing this page. Originally i did use the float: right/left instead of the absolute positioning but for some reason the right panel kept ending up on the left so I got frustrated and redid it with absolute positioning and all the div tags. I was using the IE preview in HTML-kit and it looked jacked in Mozilla, then i start reading that IE has bugs galore, so I redid it and previewed with Mozilla. The absolute way had it exactly the way I wanted it except the centering and height. This way is better. It looks the same in IE 7 cept the list in the left panel is too far to the left (it looks centered in Mozilla) and the footer but thats no biggie. Thanks for taking the time to look it over, much appreciated.
 

jw0ollard

Senior member
Jul 29, 2006
220
0
0
The footer is ending up underneath the sidebar because you didn't do step #8. :)

If that step looks too convoluted, let me just explain it in layman's terms. All you need to do is move the footer OUTSIDE the "div.container" and put a div with "style="clear:both;" between them. (The "clear" div might be redundant, but it should help avoid any float problems.)
 

Marinski

Golden Member
Apr 5, 2006
1,051
0
0
classicboxingfights.blogspot.com
Its all good. I got it. Your explanation was fine, I just posted before I got that far. Now I need to go through the 28 errors and fix some then read up on the IE hacks to see if I can fix the list on the left. Other then that it looks good though.