1

My CSS:

body
{
    font-family:verdana;
    line-height:1.5em;
    color:#666;
    font-size:0.8em;
}

.objectAttributesOuter
{
    border: 1px solid #999;
    padding:6px;
    margin:6px;
    background-color:#EDEEFA
}


.objectAttributes
{
    padding: 5px, 0px, 5px, 5px;
}


.whiteBoxWithBorder
{
    padding:5px;
    margin-right:5px;
    background-color:#fff;    
    border: solid 1px #ccc;
    float:left;
}

My HTML:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<Title>Details</Title>
<link rel  = "stylesheet" href="css.css" type = "text/css" />
</HEAD>
<BODY>


<div class = "objectAttributesOuter">
    <div class="objectAttributes">
         <div class="whiteBoxWithBorder">
                GetType()
         </div> 
         <div class="whiteBoxWithBorder">
                Returns the type ...
         </div>
    </div>
</div>


</BODY>
</HTML>

The ideal render would be to have the "whiteBox" rendered inside the "objectAttributesOuter" but as you can see it overlaps. If I remove the float tag, then the 2 divs render inside the whiteBox but, do not display side by side.

Any ideas how I can have them display side by side within the "objectAttributesOuter" tag?

Dave
  • 8,163
  • 11
  • 67
  • 103

4 Answers4

2

Check this out myFiddle

Use <div style="clear:both"></div>

Random Guy
  • 2,878
  • 5
  • 20
  • 32
0

Try putting overflow:auto on .objectAttributes and see if that helps.

It would also help if you had widths on your container and the floating elements.

Billy Moat
  • 20,792
  • 7
  • 45
  • 37
0

Put a float:left on objectAttributesOuter:

.objectAttributesOuter
{
    border: 1px solid #999;
    padding:6px;
    margin:6px;
    background-color:#EDEEFA;
    float:left;
}
Lowkase
  • 5,631
  • 2
  • 30
  • 48
0

Change objectAttributesOuter class as follow;

.objectAttributesOuter
{
    border: 1px solid #999;
    padding:6px;
    margin:6px;
    background-color:#EDEEFA;
    overflow:auto;
}
Narendra
  • 3,069
  • 7
  • 30
  • 51