CSS help needed

They have: 15 posts

Joined: Dec 2007

I have created two divs called wrapper and storybox. Wrapper is supposed to hold everything on the page while storybox is a box to show latest news. I am putting the storybox inside the wrapper but storybox is appearing at the edge of wrapper, instead of being sitting inside the wrapper. You can see the attachment for a view of the layout and here is the code for wrapper and storybox:

div#wrapper {
position: relative;
margin: auto;
width: 750px;
background-color: #fff;
border: 1px #000;
padding: 11px;
text-align: left;
background-image: url(bg.gif);
border-left: 10px #ddd solid;
border-right: 10px #ddd solid; }

div#mainstorybox {
float: left;
text-align: justify;
font-family: Trebuchet, Verdana, Georgia, "Lucida Console";
font-size: 11px;
margin-left: 0px;
width: 380px;
background-color: #ebebeb;
padding-top: 10px;
padding-right: 10px;
padding-left: 10px;
border-top: 1px #ccc solid;
border-bottom: 1px #ccc solid;
}
'

I want the storybox inside the wrapper. Any clue guys what I am doing wrong?

Thanx
Max

demonhale's picture

He has: 3,278 posts

Joined: May 2005

can you post a live example of what's happening so we can easily see the problem... but I think it's the float:left property of the storybox, try replacing those with text-align:left...

calculator's picture

They have: 40 posts

Joined: Nov 2007

probably the float left, or a missing clearing paragraph.

First, add this to your stylesheet - if you don't ealready have a clearing class:

.clear{ clear:both; }
'

And could you tell us if this is the HTML code on your page?

<div id="wrapper">
<div id="storybox">
</div>
<p class="clear"></p>
</div>
'

As demonhale said post a link to your work in progress - or the whole html/css not just the css.

They have: 15 posts

Joined: Dec 2007

Thanx for the replies demonhale and calculator Smiling

calculator, your .clear thing solved the problem, but only partially. I have one more problem. I am including a php file in the main section via phpinclude. This file has a menu which has its own stylesheet. Once I include the menu.php, the storybox again goes out of the wrapper. Here is the full html code:

<body>
<div id="wrapper">
<?php include("menu.php"); ?>

<div id="mainstorybox">
<br />
<img src="images/latest.gif" />
<span class="headmain">
AmazingBoyz amaze again</span>
<br /><br />
<a href="images/mainlarge.gif" rel="lightbox" title="AmazingBoyz in action."><img src="images/mainthumb.gif" align="left" border="0" /></a>
Following some intense competition under a visibly tense atmosphere, AmazingBoyz managed to snatch victory from jaws of  defeat, mainting their undefeated outing at the Class 2 compeition.<br />
<a href="#"><img src="images/readmore.gif" border="0"  align="right"/> </a><br /><br />
</div>

<p class="clear"></p>
</div>
</body>
'

And here is the CSS for the menu.php file:

<style type="text/css">
#tabs {
font-family: Trebuchet, "Trebuchet MS" Verdana, Georgia, "Lucida Console";font-size: 12px;
width:400px; text-align:justified; background: url(icon/top.gif); margin:0px 0 0 0px; position: relative; z-index:1;}
#tabs ul {padding:0; margin:0; width:400px; list-style:none; position:relative;}
#tabs ul li {float:left; display:inline; width:125px; height:53px; margin:0 4px;}
#tabs ul li a.outer {display:block; width:125px; height:49px; border-bottom:1px solid #9c9c9c; text-align:center; line-height:45px; text-decoration:none; text-indent:50px; color:#777; font-weight:bold; margin-bottom:3px; font-size:15px;}

#tabs ul li a.one {background:#fff url(icon/world.jpg) top left no-repeat;}
#tabs ul li a.two {background:#fff url(icon/key.jpg) top left no-repeat;}
#tabs ul li a.three {background:#fff url(icon/mail.jpg) top left no-repeat;}
#tabs ul li a.four {background:#fff url(icon/search.jpg) top left no-repeat;}
#tabs ul li a.five {background:#fff url(icon/profile.jpg) top left no-repeat;}
#tabs ul li a.six {background:#fff url(icon/draw.jpg) top left no-repeat;}
#tabs ul li div {display:none;}

#tabs ul li:hover {padding-bottom:132px; border-bottom:1px solid #fff; color:#000; margin-bottom:0;}

#tabs ul li:hover > a.outer {color:#000; background-position:0 -55px; height:55px; cursor:default;}

* html #tabs ul li a.outer:hover {padding-bottom:130px; border-bottom:1px solid #fff; height:55px; color:#000; margin-bottom:0;background-position:0 -55px; height:55px; cursor:default;}

#tabs ul li:hover div {display:block; padding:5px; position:absolute; left:4px; top:55px; width:381px; height:118px; border-bottom:3px solid #fff;}
#tabs ul li a:hover div {display:block; padding:5px; position:absolute; left:4px; top:55px; width:381px; height:118px; border-bottom:3px solid #fff;}

#tabs ul li a:hover div.tab_left,
#tabs ul li:hover div.tab_left
{background:#fff url(icon/tab_left.gif);}

#tabs ul li a:hover div.tab_center,
#tabs ul li:hover div.tab_center
{background:#fff url(icon/tab_center.gif);}

#tabs ul li a:hover div.tab_right,
#tabs ul li:hover div.tab_right
{background:#fff url(icon/tab_right.gif);}

.clear {clear:both; height:0; line-height:0; overflow:hidden;}
#tabs span.base {display:block; height:20px;font-size:10px; color:#bc8f8f; background:url(icon/bottom.gif) bottom;}
#tabs div h5 {font-size:11px; margin-bottom:10px;}
#tabs div p {font-weight:normal; text-align:left; color:#000; margin-top:3px;}
#tabs div a img {border:0;}
#tabs div img.image {float:left; border:0; margin-top:-35px; margin-right:5px;}
#tabs div a.unlock {background:url(icon/unlock.gif); display:block; width:30px; height:30px; margin:0 auto;}
#tabs div a:hover.unlock img {visibility:hidden;}
#tabs p.bold {color:#069; padding-top:5px;}
* html #tabs p.fire {margin-top:-15px;}
* html #tabs form {margin-top:-20px;}
#tabs p.buttons {text-align:center;}
</style> 
'

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.