Forum Moderators: not2easy

Message Too Old, No Replies

Problem with float - Three and more Columns

div float columns

         

sony

2:17 pm on Sep 5, 2008 (gmt 0)

10+ Year Member



Hi,

I am new to CSS. I would like to use divs and floats to design my page. Here is the HTML I am using:


<div style="float:left;">
div 1
</div>
<div style="float:left;">
div 2
</div>

Here is the problem! I want to the numbers to appear below each other, however the div should be positioned as a 3rd column, which is not a problem. The problem is that I can show the numbers below each other.


<div style="float:left;">1</div>
<div style="float:left;">2</div>
<div style="float:left;">3</div>

Since I am using float, they will all appear next to each other (1,2,3). I want them to appear below each other without having to use a line break. They need to be appear like this:

1
2
3

I need to use divs, because I will be using some other columns after that as well.

My page should then look something like this:

div 1----div 2----1
------------------2
------------------3

I used dashes as a replacement for the space here.

I hope I was able to clarify my situation.

Thanks

jgaylord

2:42 pm on Sep 5, 2008 (gmt 0)

10+ Year Member



Sonu,

Here you go. Hope this helps!

*****************************************************************

<html>
<head><title>Table Sample</title></head>

<body style="margin: 10px;">
<div style="width: 700px; border: 1px solid black;">
<div style="float: left; border: 1px solid blue; width: 200px;">Column A<br/><br/><br/>Bottom of Column A</div>
<div style="float: left; border: 1px solid red; width: 200px;">Column B</div>
<div style="float: left; border: 1px solid green;">
<strong>Column C</strong>

<div>Row 1</div>
<div>Row 2</div>
<div>Row 3</div>
<div>Row 4</div>
<div>Row 5</div>
</div>
</div>
<div style="clear: both;"></div>
</body>

*****************************************************************

Jason Gaylord

[edited by: jatar_k at 11:39 pm (utc) on Sep. 5, 2008]
[edit reason] no sigs thanks [/edit]