7 replies [Last post]
dkemp
dkemp's picture
Offline
Regular
Seattle
Last seen: 5 years 24 weeks ago
Seattle
Timezone: GMT-8
Joined: 2005-10-11
Posts: 12
Points: 2

Howdy Smile my first post here. Great site. I've been lurking and one thing I really learned so far is to validate. So I have done so, and after resolving lots of issues, every page now validates and the CSS validator says No Errors.

So here is my request. Before I go further, perhaps you folks could take a peek and let me know where you think I am off track.

The site was started by a freelancer who created a template page for almost free. After that I have taken and hacked away at it. The result is, I dont quite understand some of the stuff - like the contentheightkeystone element.

Here's the site: http://www.bushwhackerclimbingclub.org/newsite4/

Development folders /newsite1/, 2 and 3 are still there too. Only difference in newsite3 and newsite4 is that all the pages in newsite4 have been validated.

Here is main.css - I wont show print.css here.
/* Generated by CaScadeS, a stylesheet editor for Mozilla Composer */

body { margin: 0px;
text-align: center;
color: #0D355A;
background-color: #ffffff;
height: 100%;
}

div#main { margin: 0px auto;
width: 601px;
text-align: left;
}

div#container_content { width: 100%;
height: auto;
position: relative;
min-height: 100%;
}

div#menubar { margin: 0px;
float: left;
font-family: Arial,Helvetica,sans-serif;
font-size: 11pt;
font-weight: bold;
line-height: 22px;
width: 143px;
height: 100%;
padding-left: 3px;
padding-top: 6px;
}

div#menubar a:link {
color: rgb(13, 53, 90);
background-color: #ffffff;
text-decoration: none;
}

div#menubar a:visited {
color: rgb(13, 53, 90);
background-color: #ffffff;
text-decoration: none;
}

div#menubar a:hover {
color: rgb(126, 75, 1);
background-color: #ffffff;
text-decoration: underline;
}

ul { padding: 0pt;
list-style-type: none;
margin-left: 1em;
}

li { margin: 1em 0pt;
}

div#content { margin: 0px;
float: right;
width: 440px;
padding-top: 8px;
padding-left: 8px;
background-image: url(../graphics/fadingvertline.gif);
background-repeat: no-repeat;
font-family: Arial,Helvetica,sans-serif;
font-size: 11pt;
color: rgb(13, 53, 90);
background-color: #ffffff;
}

div#content h1 { border-bottom: thin solid rgb(126, 75, 1);
font-size: 14pt;
font-weight: bold;
color: #7E4B01;
background-color: #ffffff;
width: 100%;
}

div#content h2 { font-size: 12pt;
font-weight: bold;
color: #7E4B01;
background-color: #ffffff;
}

div#content h3 { font-size: 11pt;
font-weight: bold;
color: #7E4B01;
background-color: #ffffff;
margin-bottom: 0px;
}

div#content h1, h2, h3, h4, h5, h6, p, ul { margin-top: 0pt;
}

div#content a:link { color: rgb(0, 102, 0); background-color: #ffffff;
}

div#content a:visited { color: rgb(0, 102, 0); background-color: #ffffff;
}

div#content a:hover { color: rgb(0, 102, 0);
background-color: #ffffff;
text-decoration: none;
}

.imgleft { border: 1px solid rgb(51, 51, 51);
margin: 0px 10px 0px 0px;
float: left;
}

.imgright { border: 1px solid rgb(51, 51, 51);
margin: 0px 0px 0px 10px;
float: right;
}

div#contentheightkeystone { border-bottom: 1px solid white;
clear: both;
}

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 31 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Advice for my site?

Take this bit out as it throws IE into quirks mode (not good):

<?xml version="1.0" encoding="utf-8"?>

Also, you're repeating a lot of style rules. I know you've probably gone to the CSS validator recently and it says you need to have a background colour specified for every element. Well the jury's still out on whether this is being overly pedantic and I'd personally set the background colour on a parent element and not bother about repeating it all the way through.
Also, things like this:

  div#footer a { margin: 0px 6px;
    }

  div#footer a:link { color: rgb(255, 255, 255);
    background-color: #ffffff;
    text-decoration: none;
    }

  div#footer a:visited { color: rgb(255, 255, 255);
    background-color: #ffffff;
    text-decoration: none;
    }

  div#footer a:hover { color: rgb(255, 255, 255);
    background-color: #ffffff;
    text-decoration: underline;
    }

can be simplified down to:

  div#footer a { 
  	margin: 0px 6px;
	color: rgb(255, 255, 255);
	text-decoration: none;
    }

as the visited and hover states you've set are exactly the same (although not sure why you'd want your hover to be the same). The thing with CSS is that you set a style on a parent element and the styles cascade down through every element contained within it. So, for things like links, you only need to specify styles when they're different the from the parent style, e.g. in the case of changing colour or maybe adding an underline on hover. If the styles are the same for each pseudo class, you don't need to specify them.
The same thing for where you've specified font size for different elements.
The usual way of working with font size is to set it in the body and then only apply font styles for different elements on the page when you want the style to be different.
I personally set font size as a percentage (80-83%) in the body and then use percentages or ems to change the size of elements throughout my document.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 3 years 28 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Advice for my site?

Tyssen wrote:
I personally set font size as a percentage (80-83%) in the body and then use percentages or ems to change the size of elements throughout my document.

Hi Tyssen

Owen Briggs (www.thenoodleincident.com) did extensive research to test what setting gave common font-sizes and found that 76% was the best, and then styled in ems throughout. FYI

Trevor

dkemp
dkemp's picture
Offline
Regular
Seattle
Last seen: 5 years 24 weeks ago
Seattle
Timezone: GMT-8
Joined: 2005-10-11
Posts: 12
Points: 2

Advice for my site?

Good stuff, thanks much!

Yeah, I put the <?xml version="1.0" encoding="utf-8"?> in there so it would validate - wouldnt validate without it. So, what do I do - put it in, validate, then yank it out again?

And yes, I repeated those back-ground colors so it would validate.

Great input - I'll start the changes right away. I want to have lean code for sure.

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 31 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

Advice for my site?

But it doesn't validate now because of all the uppercase tags that you've got. It should validate fine without the xml prologue.

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 3 years 28 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

Advice for my site?

dkemp wrote:
So, what do I do - put it in, validate, then yank it out again?

Leave it out for good. Just ignore any error message on that front. No-one in their right mind knowingly puts that in a page and expects it work OK.

Trevor

dkemp
dkemp's picture
Offline
Regular
Seattle
Last seen: 5 years 24 weeks ago
Seattle
Timezone: GMT-8
Joined: 2005-10-11
Posts: 12
Points: 2

Advice for my site?

Quote:
But it doesn't validate now because of all the uppercase tags

But... I dont have any upper case tags anymore - I yanked them during validation...

Ohhhh wait a minute! View Source shows the upper case tags in my Server-Side Included navbar. Right. Upper case in there. Will fix.

Quote:
Leave it out for good.

Okay, I'll rip it out.

Quote:
No-one in their right mind knowingly puts that in a page and expects it work OK.

Ouch :oops: Got it.

dkemp
dkemp's picture
Offline
Regular
Seattle
Last seen: 5 years 24 weeks ago
Seattle
Timezone: GMT-8
Joined: 2005-10-11
Posts: 12
Points: 2

Advice for my site?

Okay, its been a couple weeks. I think you'll find it much improved. Please advise or otherwise comment. Much appreciated.

Here is the site: http://www.bushwhackerclimbingclub.org/newsite7/

And here is my CSS (trimmed down from my first post, eh?)

body {
margin: 0px;
text-align: center;
width: 100%;
height: 100%;
font-family: Arial,Helvetica,sans-serif;
font-size: .9em;
color: #0D355A;
background-color: #ffffff;
}

div#main { margin: 0px auto;
width: 601px;
text-align: left;
}

div#mainnav {
width: 143px;
height: 100%;
float: left;
font-size: .8em;
font-weight: bold;
line-height: 18px;
}

div#mainnav a {
color: #0D355A;
text-decoration: none;
}

div#mainnav a:hover {
font-size: 1.1em;
color: navy;
text-decoration: underline;
}

div#mainnav ul {
padding: 0em;
list-style-type: none;
margin-top: 1em;
margin-left: .5em;
}

div#mainnav ul ul {
margin-left: 1.1em;
line-height: .5em;
font-weight: normal;
list-style-type: disc;
}

div#mainnav li {
margin: 1em 0 0 0;
}

.current {
color: red;
text-decoration: none;
}

div#content { margin: 0em;
float: right;
width: 440px;
padding-top: 8px;
padding-left: 8px;
background-image: url(../graphics/fadingvertline.gif);
background-repeat: no-repeat;
}

div#content h1, h2, h3, h4, h5, h6 {
margin-top: 0em;
color: #7E4B01;
}

div#content h1 {
font-size: 1.2em;
}

div#content h2 {
font-size: 1.1em;
}

div#content h3 {
font-size: 1em;
}

div#content a { color: rgb(0, 102, 0);
}

div#content a:hover {
color: navy;
}

.imgleft { border: 1px solid rgb(51, 51, 51);
margin: 0px 10px 0px 0px;
float: left;
}

.imgright { border: 1px solid rgb(51, 51, 51);
margin: 0px 0px 0px 10px;
float: right;
}

div#contentheightkeystone { border-bottom: 1em solid white;
clear: both;
}