473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Floating multiple divs into three virtual columns

I have a test page put up here:
http://law-monitor.com/trying.html

As you can see there are 6 divs (class: view-row) inside a main container div (class: container).

I have just the following css for the page:

.container{
padding: 10px 0 0 10px;
background:#222222;
float:left;
width:970px;
}
.view-row{
width:293px;
padding:10px;
margin:0 10px 10px 0;
float:left;
background:white;
font-family: georgia, serif;
font-size: 10px;
}

I would have expected that the bottom three divs (which have their floats set), would move all the way up and stick to the bottom of the upper divs.
Instead the lower three divs' top edges align with the bottom of the tallest div. Is this how its supposed to be? How do I make it such that the divs automatically move all the way up?

help! please!
Feb 19 '10 #1

✓ answered by drhowarddrfine

Is this how its supposed to be?
Yes. Block level elements layer on top of each other from top->bottom and left->right. It's actually the 3rd element that's blocking the last 3 from being higher.
How do I make it such that the divs automatically move all the way up?
I just woke up and you're asking me this? Javascript will do but can it be done with CSS? First groggy thought: no. If I think of something else. I'll be back.

3 3811
drhowarddrfine
7,435 Expert 4TB
Is this how its supposed to be?
Yes. Block level elements layer on top of each other from top->bottom and left->right. It's actually the 3rd element that's blocking the last 3 from being higher.
How do I make it such that the divs automatically move all the way up?
I just woke up and you're asking me this? Javascript will do but can it be done with CSS? First groggy thought: no. If I think of something else. I'll be back.
Feb 19 '10 #2
Thanks for this. Now that I know that its not some CSS coding error on my part, I am going to fix this with javascript, just as you suggested.
Although it would be fantastic if it could be done via CSS alone.
Thanks again
Feb 19 '10 #3
seegoon
31
It's highly counter-intuitive, but you could contain the columns vertically, instead of horizontally, so that you have three container divs. The problem with that is that although the reading order would be div 1, div 2, 3, 4, 5, 6, the order in the html would be 1, 4, 2, 5, 3, 6. So perhaps JS is a better idea.
Feb 23 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris | last post by:
Hi, I am pretty new to CSS authoring and find myself in a tricky situation. I have a series of divs (dynamically generated - there could be up to 8) as follows: <div class="person">...
2
by: Egon Pasztor | last post by:
Hi. I'm new at CSS, so maybe this is obvious, but I've looked around quite a bit looking for a solution. I'm playing with the vertical positioning of elements in a 2-column layout. The...
2
by: pembed2003 | last post by:
Hi all, I recently saw a piece of code that looks like: class one{public: one(){} }; class two : public virtual one{public: two(){} }; class three : virtual public one{public: three(){} }; ...
1
by: Phil | last post by:
We want to create fictional character names for a children's project, and have selected 30 first names, 30 last names, and want to include 26 (a-z) middle initials. Therefore there are 30x30x26 =...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
1
by: billyudi | last post by:
I followed this post to use a form drop down to show/hide divs. http://www.thescripts.com/forum/thread150206.html Now I need to be able to show two or three divs at once while hiding all the...
3
by: helpmeplease213 | last post by:
Hello, I have query that picks out all data that is above 40 and use >"40" in the criteria section of the query. Now I have three different columns that have this data and a unit column. Now the...
7
by: zenbob | last post by:
Greetings, and thanks in advance for considering my problem. I am working in a basic .htm page, in which I want to close all displayed DIVs with one event. In IE, I find that this works: ...
4
by: Adam | last post by:
Hi all, I've got a tricky CSS problem that I could use some help with. What I'm trying to do is to set up a column-based layout, with each column holding a number of <divblocks. These div blocks...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.