Reputation: 2110
I have two divs, like the image attached. Mi problem is that div2 didn't go under div1 (when div1 finish), as shown in image1, but remains in column (like the second image attached).
div1 css is:
width: 391px;
height: 380px;
float: left;
margin-right: 10px;
while div2 css ishas no css (i don't know what to insert).
How can i do?
Thanks, Mattia
Upvotes: 3
Views: 13754
Reputation: 12159
There is no div
in L format like that on your first image, divs are rectangles.
If you want a design like that first image, follow gabitzish and/or Arjen van Heck, if you want a div
below other (two rectangles), put clear: both;
on the second div's css rules.
Upvotes: 0
Reputation: 123367
Assuming your markup is
<div id="div1">...</div>
<div id="div2">...</div>
You have to do absolutely nothing, since if div2
has no style applied then the whole layout will be like that on figure 1
see fiddle: http://jsfiddle.net/qAqv3/
Upvotes: 3
Reputation: 1116
you could make a div inside a div, then set the second div related to the first (atleast i think that is what your tryin to do)
#Menu
{
position:absolute;
text-align: left;
width="1024px";
height="768px";
}
#startButton
{
position:relative;
left: 400px;
top: -350px;
}
<div id="Menu"> <img src="path/to/img.jpg" width="1024px" height="768px"></img>
<div id="startButton">
<img src="path/to/img.jpg">
</div>
</div>
i hop this helps you :)
Upvotes: 1
Reputation: 9691
A div can have only one width and only one height, so it can only be a rectangle. You could insert your div1 into div2, and set the content of div2 (including div1) with float:left .
Here is a demo : http://jsfiddle.net/DX2vJ/1/
Upvotes: 2