shades99
04-16-2010, 01:12 PM
I have a problem with css.
I have php-included a css menu on my page. The problem is that for some reason I can not see, when I include the menufile there is a vertical space between the menu and the sidebar and maincontent area. I want those to be right below the menu with 0 padding.
See the attached screenshot at the bottom for an example how it looks
the css menu has its own css file.
Here is the source code for the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/test.css" rel="stylesheet" type="text/css" /><!--[if IE 5]>
<link href="Resources/chromemenu/chrometheme/chromestyle.css" rel="stylesheet" type="text/css" />
</head>
<body class="twoColFixRtHdr">
<div id="container">
<div id="header">
<h1> </h1></div>
<?php include('css/meny2.php');?>
<div id="sidebar1">
<h3>Sidebar1 Content</h3>
<p> </p>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<h1> </h1>
<!-- end #mainContent --></div>
<br class="clearfloat" />
<div id="footer">
<p></p>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
Here is the CSS for the page:
@charset "utf-8";
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
.twoColFixRtHdr #container {
width: 972px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
background: #FFFFFF; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
}
.twoColFixRtHdr #header h1 {
margin: 0;
height: 115px;
padding-top: 0px;
padding-right: 0;
padding-bottom: 0px;
padding-left: 0;
width: 972px;
}
.twoColFixRtHdr #sidebar1 {
float: right; /* since this element is floated, a width must be given */
width: 200px; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 15px 10px;
background-color: #EBEBEB;
background-image: url(../Resources/grafik/bg_main.jpg);
}
.twoColFixRtHdr #mainContent {
margin: 0 250px 0 0; /* the right margin on this div element creates the column down the right side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.twoColFixRtHdr #footer {
padding: 0 10px 0 20px;
}
.twoColFixRtHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
Here is the code for the menu file
<div id="meny">
<div class="chromestyle style1" id="chromemenu">
<ul>
<li><a href="http://test.com/test.html/index.php">Hem</a></li>
<li><a href="#" rel="dropmenu1">Om test</a></li>
<li><a href="http://test.se/se/tjanster.php" rel="dropmenu2">Produkter & Tjänster</a></li>
<li><a href="http://test.com/test.html/blanketter.php">Blanketter & Broschyrer</a></li>
</ul>
</div>
</div>
<p> </p>
<!--1:a drop-down menyn -->
<div id="dropmenu1" class="dropmenudiv">
<a href="http://test.se/se/test_info.php">Om test</a>
<a href="http://test.com/test.html/juridiskinformation.php">Juridisk information / Priser</a>
<a href="http://test.se/se/kapitaltackning.php">Kapitaltäckning</a>
<a href="http://test.se/se/foretagsstruktur.php">Företagsstruktur</a>
</div>
<!--2:a drop down menyn -->
<div id="dropmenu2" class="dropmenudiv" style="width: 165px;">
<a href="http://test.com/test.html/multiassetportfolio.php">Kapitalförvaltning</a>
<a href="http://test.com/test.html/pension.php">Pension / Fondförsäkring</a>
<!-- <a href="http://test.se/se/belaning.php">Belåning</a> -->
</div>
</div>
Here is the CSS for the menu:
.chromestyle{
width: 970px;
font:11px Verdana;
font-weight: bold;
}
.chromestyle:after{ /*Add margin between menu and rest of content in Firefox*/
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.chromestyle ul{
border: 1px solid #BBB;
width: 100%;
background: url(chromebg.gif) center center repeat-x; /*THEME CHANGE HERE*/
padding: 4px 0;
margin: 0;
text-align: left; /*set value to "left", "center", or "right"*/
}
.chromestyle ul li{
display: inline;
}
.chromestyle ul li a{
color: #494949;
padding: 4px 7px;
margin: 0;
text-decoration: none;
border-right: 1px solid #DADADA;
}
.chromestyle ul li a:hover{
background: url(chromebg-over.gif) center center repeat-x; /*THEME CHANGE HERE*/
}
.chromestyle ul li a[rel]:after{ /*HTML to indicate drop down link*/
content: " ";
/*content: " " url(downimage.gif); /*uncomment this line to use an image instead*/
}
/* ######### Style for Drop Down Menu ######### */
.dropmenudiv{
position:absolute;
top: 0;
border: 1px solid #BBB; /*THEME CHANGE HERE*/
border-bottom-width: 0;
font:normal 10px Verdana;
line-height:18px;
z-index:100;
background-color: white;
width: 200px;
visibility: hidden;
filter: progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=4); /*Add Shadow in IE. Remove if desired*/
}
.dropmenudiv a{
width: auto;
display: block;
text-indent: 3px;
border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/
padding: 2px 0;
text-decoration: none;
font-weight: bold;
color: black;
}
* html .dropmenudiv a{ /*IE only hack*/
width: 100%;
}
.dropmenudiv a:hover{ /*THEME CHANGE HERE*/
background-color: #F0F0F0;
}
Thanks in advance for any replies........
I have php-included a css menu on my page. The problem is that for some reason I can not see, when I include the menufile there is a vertical space between the menu and the sidebar and maincontent area. I want those to be right below the menu with 0 padding.
See the attached screenshot at the bottom for an example how it looks
the css menu has its own css file.
Here is the source code for the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="css/test.css" rel="stylesheet" type="text/css" /><!--[if IE 5]>
<link href="Resources/chromemenu/chrometheme/chromestyle.css" rel="stylesheet" type="text/css" />
</head>
<body class="twoColFixRtHdr">
<div id="container">
<div id="header">
<h1> </h1></div>
<?php include('css/meny2.php');?>
<div id="sidebar1">
<h3>Sidebar1 Content</h3>
<p> </p>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<h1> </h1>
<!-- end #mainContent --></div>
<br class="clearfloat" />
<div id="footer">
<p></p>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
Here is the CSS for the page:
@charset "utf-8";
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
.twoColFixRtHdr #container {
width: 972px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
background: #FFFFFF; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
margin-top: 0;
margin-right: auto;
margin-bottom: 0;
margin-left: auto;
}
.twoColFixRtHdr #header h1 {
margin: 0;
height: 115px;
padding-top: 0px;
padding-right: 0;
padding-bottom: 0px;
padding-left: 0;
width: 972px;
}
.twoColFixRtHdr #sidebar1 {
float: right; /* since this element is floated, a width must be given */
width: 200px; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 15px 10px;
background-color: #EBEBEB;
background-image: url(../Resources/grafik/bg_main.jpg);
}
.twoColFixRtHdr #mainContent {
margin: 0 250px 0 0; /* the right margin on this div element creates the column down the right side of the page - no matter how much content the sidebar1 div contains, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. */
padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.twoColFixRtHdr #footer {
padding: 0 10px 0 20px;
}
.twoColFixRtHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right;
margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page */
float: left;
margin-right: 8px;
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
Here is the code for the menu file
<div id="meny">
<div class="chromestyle style1" id="chromemenu">
<ul>
<li><a href="http://test.com/test.html/index.php">Hem</a></li>
<li><a href="#" rel="dropmenu1">Om test</a></li>
<li><a href="http://test.se/se/tjanster.php" rel="dropmenu2">Produkter & Tjänster</a></li>
<li><a href="http://test.com/test.html/blanketter.php">Blanketter & Broschyrer</a></li>
</ul>
</div>
</div>
<p> </p>
<!--1:a drop-down menyn -->
<div id="dropmenu1" class="dropmenudiv">
<a href="http://test.se/se/test_info.php">Om test</a>
<a href="http://test.com/test.html/juridiskinformation.php">Juridisk information / Priser</a>
<a href="http://test.se/se/kapitaltackning.php">Kapitaltäckning</a>
<a href="http://test.se/se/foretagsstruktur.php">Företagsstruktur</a>
</div>
<!--2:a drop down menyn -->
<div id="dropmenu2" class="dropmenudiv" style="width: 165px;">
<a href="http://test.com/test.html/multiassetportfolio.php">Kapitalförvaltning</a>
<a href="http://test.com/test.html/pension.php">Pension / Fondförsäkring</a>
<!-- <a href="http://test.se/se/belaning.php">Belåning</a> -->
</div>
</div>
Here is the CSS for the menu:
.chromestyle{
width: 970px;
font:11px Verdana;
font-weight: bold;
}
.chromestyle:after{ /*Add margin between menu and rest of content in Firefox*/
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.chromestyle ul{
border: 1px solid #BBB;
width: 100%;
background: url(chromebg.gif) center center repeat-x; /*THEME CHANGE HERE*/
padding: 4px 0;
margin: 0;
text-align: left; /*set value to "left", "center", or "right"*/
}
.chromestyle ul li{
display: inline;
}
.chromestyle ul li a{
color: #494949;
padding: 4px 7px;
margin: 0;
text-decoration: none;
border-right: 1px solid #DADADA;
}
.chromestyle ul li a:hover{
background: url(chromebg-over.gif) center center repeat-x; /*THEME CHANGE HERE*/
}
.chromestyle ul li a[rel]:after{ /*HTML to indicate drop down link*/
content: " ";
/*content: " " url(downimage.gif); /*uncomment this line to use an image instead*/
}
/* ######### Style for Drop Down Menu ######### */
.dropmenudiv{
position:absolute;
top: 0;
border: 1px solid #BBB; /*THEME CHANGE HERE*/
border-bottom-width: 0;
font:normal 10px Verdana;
line-height:18px;
z-index:100;
background-color: white;
width: 200px;
visibility: hidden;
filter: progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=4); /*Add Shadow in IE. Remove if desired*/
}
.dropmenudiv a{
width: auto;
display: block;
text-indent: 3px;
border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/
padding: 2px 0;
text-decoration: none;
font-weight: bold;
color: black;
}
* html .dropmenudiv a{ /*IE only hack*/
width: 100%;
}
.dropmenudiv a:hover{ /*THEME CHANGE HERE*/
background-color: #F0F0F0;
}
Thanks in advance for any replies........