CSS help please

Soldato
Joined
15 Feb 2003
Posts
10,167
Location
Europe
Hi I just have a basic CSS question.

How do I fix the height of my page?

At the moment the site i'm working on at www.eastcoastlacrosse.co.uk/modx/playlacrosse changes it height depening on the contented. I want so fix the height so that the page does not jump up and down when clicking on areas with differing amounts of content.

Another issue is that when I add more navigational items to the menu they appear underneath the current links and push all my content down under the main content section and over to the right.

My css file is below - what do I need to change to stop this happening?

Code:
/******RESET DEFAULTS*******/* {  margin:0;  padding:0;}/*******DROP SHADOW*******/.dropshadow { background: transparent url(../images/dropshadowborder.jpg) repeat-y; width: 719px; height: auto; margin:0 auto;}/******GLOBAL STYLES*******/body {  font-family: verdana, Arial, Georgia, Palatino, serif;  background-color: #767676;}h1 {  color: #B9CADD;font-size: 20px;}h2 {  font-size: 20px;}span {  display: none;}img {  padding-top: 4px;  padding-bottom: 3px;  padding-left: 4px;}.p1 {  padding-top: 8px;  padding-left: 8px;  padding-right: 20px;  padding-bottom: 8px;} #wrapper {  margin: 0 auto;  width: 608px;  background-color: #525252;  border: 2px solid #FFFFFF;}h1.banner {  width: 608px;  height: 130px;  background: url(../images/banner.jpg) no-repeat center top;}/*******NAVIGATION*******/#navigation {  width: 608px;  height: 36px;  background: url(../images/NavBar.jpg) no-repeat center top;  border-top: 2px solid #FFFFFF;}#navigation ul {  padding-top: 1px;  list-style: none;  width: 608px;  height: 35px;}#navigation ul li {  float: left; }#navigation ul a {  float: left;   padding-left: 28px;  padding-right: 28px;  padding-top: 1px;  height: 20px;  background: url(../images/divider.jpg) repeat-y left top;  text-decoration: none;  font-size: 12px;  color: #fff;}#navigation ul a:hover {  color: #9BB5DB;}#menu ul li {  display: inline;}/***********links************/a {text-decoration: none; }a:link {color: #ffffff; text-decoration: none; }a:visited {color: #9BB5DB; text-decoration: none; }a:hover {color: #f4bcd7; text-decoration: underline; }/*******CONTENT BOXES*******/#maincontent {  overflow: hidden;  width: 608px;  background: #293F57 url(../images/FauxColumn.jpg) repeat-y left top;}#leftcontent {  width: 421px;  float: left;  font: 9pt/14pt verdana;  color: #D6E7FC; }#rightcontent {  width: 187px;  float: right;  font: 9pt/12pt verdana;}/*******LEFT CONTENT IMAGES*******/h2.welcome {   background-image: url(../images/Welcome.jpg);   background-repeat: no-repeat;   background-position: left;   width: 220px;   height: 22px;}h2.female {   background-image: url(../images/Female.jpg);   background-repeat: no-repeat;   background-position: left;   width: 220px;   height: 22px;}h2.news {   background-image: url(../images/News.jpg);   background-repeat: no-repeat;   background-position: left;   width: 220px;   height: 22px;}h2.contact {   background-image: url(../images/contact.jpg);   background-repeat: no-repeat;   background-position: left;   width: 220px;   height: 22px;}/*******RIGHT CONTENT FORMATTING*******//*******EAST 2 TABLE*******/#East2, #resources {   padding-top:8px;}#East2 table {  margin-top: 8px;  margin-left: 8px;  font-size: 0.8em;  color: #FFFFFF;  width: 170px;}#East2 table tr {  height: 16px;}#East2 table tr td.center {  text-align: center; }#East2 table tr td.team {  width: 80px;}#East2 table tr td {  background-color: #59728E;  height: 20px;}#East2 table tr.odd td {  background-color: #6A8AAC;}#East2 h2{   background: url(../images/East2.jpg) no-repeat left top;   width: 187px;   height: 30px;}/*******RESOURCES LINKS*******/#resources h2{   background: url(../images/Resources.jpg) no-repeat left top;   width: 187px;   height: 30px;} #resources ul {  padding-top: 5px;  padding-left: 10px;  padding-right: 5px;  list-style: none;}#resources ul li {  padding-top: 5px;  font-size: 10px;  color: #9DBCE4;}#resources ul li a{  text-decoration: none;  font-size: 13px;  color: #D6E7FC;}/*******GOOGLE SEARCH BAR*******/#google h2 {  background: url(../images/google.jpg) no-repeat left top;  width: 187px;  height: 30px;}#google form {  padding-top: 10px;  padding-left: 10px;}/*******FOOTER*******/#site-info	{  margin: 0 auto;  background: url(../images/footerpic2.jpg);  background-repeat: no-repeat;  background-position: left;  width: 719px;  height: 46px;}#site-info .p2 {  font-size: 11px;  color: #BABABA;  padding-top: 5px;  padding-left: 205px;}#site-info .p2 a {  text-decoration: none;  color: #EEEEEE;}#site-info .p2 a:hover {  color: #9BCADB;}
 
It was formatted like that but everytime I try to view it in notpad 2, notepad, gedit it reverts back to how it is here.

Code:
* {
margin : 0;
padding : 0;
}
.dropshadow {
background : transparent url(../images/dropshadowborder.jpg) repeat-y;
width : 719px;
height : auto;
margin : 0 auto;
}
body {
font-family : verdana, Arial, Georgia, Palatino, serif;
background-color : #767676;
}
h1 {
color : #b9cadd;
font-size : 20px;
}
h2 {
font-size : 20px;
}
span {
display : none;
}
img {
padding-top : 4px;
padding-bottom : 3px;
padding-left : 4px;
}
.p1 {
padding-top : 8px;
padding-left : 8px;
padding-right : 20px;
padding-bottom : 8px;
}
#wrapper {
margin : 0 auto;
width : 608px;
background-color : #525252;
border : 2px solid #ffffff;
}
h1.banner {
width : 608px;
height : 130px;
background : url(../images/banner.jpg) no-repeat center top;
}
#navigation {
width : 608px;
height : 36px;
background : url(../images/NavBar.jpg) no-repeat center top;
border-top : 2px solid #ffffff;
}
#navigation ul {
padding-top : 1px;
list-style : none;
width : 608px;
height : 35px;
}
#navigation ul li {
float : left;
}
#navigation ul a {
float : left;
padding-left : 28px;
padding-right : 28px;
padding-top : 1px;
height : 20px;
background : url(../images/divider.jpg) repeat-y left top;
text-decoration : none;
font-size : 12px;
color : #fff;
}
#navigation ul a:hover {
color : #9bb5db;
}
#menu ul li {
display : inline;
}
a {
text-decoration : none;
}
a:link {
color : #ffffff;
text-decoration : none;
}
a:visited {
color : #9bb5db;
text-decoration : none;
}
a:hover {
color : #f4bcd7;
text-decoration : underline;
}
#maincontent {
overflow : hidden;
width : 608px;
background : #293f57 url(../images/FauxColumn.jpg) repeat-y left top;
}
#leftcontent {
width : 421px;
float : left;
font : 9pt/14pt verdana;
color : #d6e7fc;
}
#rightcontent {
width : 187px;
float : right;
font : 9pt/12pt verdana;
}
h2.welcome {
background-image : url(../images/Welcome.jpg);
background-repeat : no-repeat;
background-position : left 0%;
width : 220px;
height : 22px;
}
h2.female {
background-image : url(../images/Female.jpg);
background-repeat : no-repeat;
background-position : left 0%;
width : 220px;
height : 22px;
}
h2.news {
background-image : url(../images/News.jpg);
background-repeat : no-repeat;
background-position : left 0%;
width : 220px;
height : 22px;
}
h2.contact {
background-image : url(../images/contact.jpg);
background-repeat : no-repeat;
background-position : left 0%;
width : 220px;
height : 22px;
}
#East2, #resources {
padding-top : 8px;
}
#East2 table {
margin-top : 8px;
margin-left : 8px;
font-size : 0.8em;
color : #ffffff;
width : 170px;
}
#East2 table tr {
height : 16px;
}
#East2 table tr td.center {
text-align : center;
}
#East2 table tr td.team {
width : 80px;
}
#East2 table tr td {
background-color : #59728e;
height : 20px;
}
#East2 table tr.odd td {
background-color : #6a8aac;
}
#East2 h2 {
background : url(../images/East2.jpg) no-repeat left top;
width : 187px;
height : 30px;
}
#resources h2 {
background : url(../images/Resources.jpg) no-repeat left top;
width : 187px;
height : 30px;
}
#resources ul {
padding-top : 5px;
padding-left : 10px;
padding-right : 5px;
list-style : none;
}
#resources ul li {
padding-top : 5px;
font-size : 10px;
color : #9dbce4;
}
#resources ul li a {
text-decoration : none;
font-size : 13px;
color : #d6e7fc;
}
#google h2 {
background : url(../images/google.jpg) no-repeat left top;
width : 187px;
height : 30px;
}
#google form {
padding-top : 10px;
padding-left : 10px;
}
#site-info {
margin : 0 auto;
background : url(../images/footerpic2.jpg);
background-repeat : no-repeat;
background-position : left 0%;
width : 719px;
height : 46px;
}
#site-info .p2 {
font-size : 11px;
color : #bababa;
padding-top : 5px;
padding-left : 205px;
}
#site-info .p2 a {
text-decoration : none;
color : #eeeeee;
}
#site-info .p2 a:hover {
color : #9bcadb;
}

I put it through a W3C's validator so get it back in format but it strips out /***these bits ***/
 
Last edited:
The menu itself is php as created by the wayfinder snippet in Modx CMS.

But it would do just the same on my HTML version


Code:
/*******NAVIGATION*******/



#navigation {

  width: 608px;

  height: 36px;

  background: url(images/NavBar.jpg) no-repeat center top;

  border-top: 2px solid #FFFFFF;

}



#navigation ul {

  padding-top: 1px;

  list-style: none;

  width: 608px;

  height: 35px;

}



#navigation ul li {

  float: left; 

}



#navigation ul a {

  float: left; 

  padding-left: 28px;

  padding-right: 28px;

  padding-top: 1px;

  height: 20px;

  background: url(images/divider.jpg) repeat-y left top;

  text-decoration: none;

  font-size: 13px;

  color: #fff;

}



#navigation ul a:hover {

  color: #9BB5DB;

}
 
Yeah the HTML is different as one site is static and the other (the one not working correctly) is content managed using Modx.

To be honest on todays huge screens I would prefer the site to be wider taking up about 50% of the screen area in the centre of the screen - obviously resizing for different resolutions. Is that easily achievable?
 
Well your HTML is a bit of a mess, but ignoring that for now, here's how to fix the main problems (only tested in FF):

  1. Put clear:both; on #maincontent
  2. Take the width off of #navigation ul
  3. Rename your menu items so that they fit on one line


Mick.
 
Back
Top Bottom