First All-CSS Page...

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

I'm currently working on a relatively simply laid-out site for my first page where all design elements are pretty much CSS. Lots of fun.

And frustrations. I have the layout working fine in Firefox, but it looks wrong in IE. The CSS validates, if that helps any.

http://www.tandswebdesign.com/samples/plantech/

I was also trying to figure out some way for the page to be centered, instead of on the left, if anyone can help with that as well.

I'll also include my HTML and CSS code. Don't worry, it's relatively brief.

Here's my HTML code:

Quote:

Plantech

Plantech Associates
IT Project Management and Consulting Services

Welcome
About Us
Mission
Services
History
Contact Us

Hand Clicking Mouse
Plantech Associates Inc. is an information technologies consulting firm
offering services for project management, business analysis, interim IT
management and strategic planning. Since 1989, we have managed successful IT
projects in the United States and Canada, and recently incorporated to further
expand and develop project management solutions and services.

Based in Oklahoma City, Plantech stresses project management professionalism,
ethics, objectivity, sensitivity to our clients' organizations, and laser-like
alignment with their business objectives. Success is achieved through close
collaboration, earned trust and senior-level IT management expertise.

We are members of the Project Management Institute,
and practice according to the professional and ethical tenants promoted by this
prominent professional organization. Plantech Associates supports the
certification of project managers as Project Management Professionals (PMP)
through PMI.

And here's the CSS:

Quote:
body
{
font-family: Arial, sans-serif;
font-size: 10pt;
color: #fff;
margin: 0px;
padding: 0px;
background: #fff;
}

#pageHeader h1
{
background: transparent url('images/header.png') no-repeat top;
width: 746px;
height: 111px;
float: none;
margin-left: 50px;
margin-bottom: 0px;
padding-bottom: 0px;
}

#pageHeader h1 span
{
display:none;
}

#pageHeader h2 span
{
display:none;
}

#menu
{
background: url('images/logobottom.jpg') no-repeat top left #82ACD5;
width: 151px;
margin-left: 67px;
padding-top: 0px;
border-left: 1px solid black;
border-right: 1px solid black;
border-bottom: 1px solid black;
height: 400px;
text-align: left;
padding-left: 10px;
position: absolute;
}

#content
{
background: #0F60AF;
width: 547px;
margin-left: 230px;
border-right: 1px solid black;
border-bottom: 1px solid black;
margin-bottom: 10px;
height: 400px;
position: absolute;
}

#content p
{
text-indent: 20px;
padding-left: 10px;
padding-right: 10px;
}

#content img
{
float: right;
border-left: 1px solid black;
border-bottom: 1px solid black;
margin-left: 10px;
margin-bottom: 10px;
margin-right: -1px;
}

Hopefully that's not too much info. I would appreciate any help, of course. I'm looking to be table-free!

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I would probably put everything in a container div and give it a margin:0 auto; or margin:0 5%;

Try that and see if it helps Smiling

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Renegade wrote: I would probably put everything in a container div and give it a margin:0 auto; or margin:0 5%;

Try that and see if it helps Smiling

No luck. I tried it on my local copy, and it didn't help.

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

My site is centered, check the code there. I forget how I did that. I'm pretty sure it's a container DIV but I forget what CSS I put in there.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Thanks, Megan.

While the site is now centered (at least in FireFox), The big problem of appearing all screwy in IE is still there. Any ideas?

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Does the HTML validate? Use a doctype. Wink

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Thanks! Since I'm using FP, I've only looked at my HTML validation once or twice, then decided I'd lose less hair if I stopped worrying about it.

But since I hand-coded this page (still in FP, though), that was th eonly thing that didn't validate. It's now valid, though I'm not 100% sure that I'm using the right doctype.

That did fix the space between the menu and the content divs. Now I just have the problem between those two and the pageHeader div above it.

Any more ideas? These have been greatly helpful so far, and I'm so close now!

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

I figured it out. I needed to apply all the header stuff to my pageheader div, not just the first in it. IE was inserting a blank line for the second .

He has: 1,758 posts

Joined: Jul 2002

centering in css is quite easy. Firstly, add text-align: center to your body tag, this is for IE. Then, put a wrapper div around your content with a fixed width, set the text-align: left and margin left and right to "auto" (margin: 0 auto 0 auto).

Problem solved.

Andy

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Thanks, Andyk. I'll give that a try.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

One last (hopefully) question. I've got almost everything how I want it, but I can't seem to get rid of the right border on the image. Here's the tag for the image:

#content img
{
float: right;
border-left: 1px solid black;
border-bottom: 1px solid black;
border-right: 0px hidden black;
margin-left: 10px;
margin-bottom: 10px;
/* margin-right: -1px; */
}

The margin-right part was working fine before, but I set the containing div's overflow to auto to allow a scroll bar, so that makes it have a vertical scroll bar as well.

Any ideas here? The containing div also has a right border, so I'm not sure what the deal is.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

Oh, you can see the latest CSS and HTML here: http://www.tandswebdesign.com/samples/plantech/

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

I can't believe I did this. There was an actual black line down the side of the image. In other words, it was part of the image itself. Problem fixed.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.