Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-21-2010, 03:38 AM   PM User | #1
Cloud Ghost
New Coder

 
Join Date: Jan 2010
Location: Canada
Posts: 34
Thanks: 11
Thanked 4 Times in 4 Posts
Cloud Ghost is an unknown quantity at this point
Text not in center of page

Hey!

I'm working on a layout here for somebody: http://pinkcottoncandy.net/new.php

I have two problems with CSS I can't figure out. First the layout isn't completely centered. And second the text for the page content isn't completely centered. If anyone knows how to fix both/one of these errors please let me know.
Cloud Ghost is offline   Reply With Quote
Old 03-21-2010, 07:07 AM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello Cloud Ghost,
Good job on the valid code! There is one error in your CSS, no such thing as float:top;

You should take a look at a simple two column demo for a basic layout to follow.
In your code, you put 752px wide #header inside 706px wide #container ... the box model shows how to figure your widths so things fit inside their containing divs.

Try making these changes to your CSS -
Code:
body {
   text-align:center;
   font-size:13px;
   font-family:Trebuchet MS;
   background:#2ff5ff;
margin: 0; /*zero out padding in body so you don't need negative margin to pull #container back up*/
}

#container {
width:752px; /*a width that actually contains your site*/
   font-size:13px;
   font-family:Trebuchet MS;
   background-image: url(http://pinkcottoncandy.net/images/pcc_bg.jpg);
margin:0 auto;
}

#header {
   width:752px;
}

#admin {
   width:700px;
   /*float:top; no such thing*/
}

#content {
margin: 0 50px 0 170px; /*margined over to make room for #sidebar*/
   color:#000;
}

#sidebar {
width:170px;
   float:left;
   text-align:left;
   list-style-type: none;
}
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
Cloud Ghost (03-21-2010)
Old 03-21-2010, 07:33 AM   PM User | #3
Cloud Ghost
New Coder

 
Join Date: Jan 2010
Location: Canada
Posts: 34
Thanks: 11
Thanked 4 Times in 4 Posts
Cloud Ghost is an unknown quantity at this point
Thanks Excavator! Just one more problem. Now the page content is under the sidebar content: http://pinkcottoncandy.net/new.php
Cloud Ghost is offline   Reply With Quote
Old 03-21-2010, 09:23 AM   PM User | #4
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Compare your version to the one I posted. You'll see yours still has the width and float... remove those two lines.
Like this -
Code:
#content {
 /*  width:520px;
  float:right; */
   color:#000;
   margin: auto 50px 0 170px;
}
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Reply

Bookmarks

Tags
css, text

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:45 PM.


Advertisement
Log in to turn off these ads.