473,386 Members | 1,842 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,386 software developers and data experts.

Looking for a way to float: BOTH

Dear all,

I am trying to make a relatively simple layout with two adjustment
columns filled with short news pieces, but there's a catch. I cannot
control the html for these news bits, so I am left with CSS only for
positioning etc. My problem is the following. The most natural way to do
what I want is to use "float: left" (or "float: right") for my news bits
and see them all filling the space. However, there's the catch: if the
news bits are allowed to be significantly different in size, then
sometimes "float: left" would leave unnecessarily large spaces on the
left (or, for "float: right", on the right), see the following simple
example:

<html>
<head>
<style type="text/css">
div { border: solid black 1px; }
#box1 { width: 49%; height: 100px; float: left; }
#box2 { width: 49%; height: 200px; float: left; }
#box3 { width: 49%; height: 300px; float: left; }
</style>
</head>

<body>

<div id="box1">1</div>
<div id="box2">2</div>
<div id="box3">3</div>

</body>
</html>

What I really want is to fill in the space under box no. 1. Can I
somehow tell browser to use "float: left or right" (not literally, mind
you :) ), so that the space is filled completely? Are there any other
ways to perform this task that I am not aware of?

Best wishes,
Alex
Jul 21 '05 #1
2 4298
that's really hard.
I've been playing some with your test page, and I couldn't figure out
anything. (no surprise, I'm a newbie).
Anyway, if you are 'experienced', you can mess something around with
negative margins, and see what happens.
In your example, making box3 have a margin-top:-100, makes it fit. The
issue is 'how much????'. Maybe you find something....
have fun...

Jul 21 '05 #2
Penguinny wrote:
Dear all,

I am trying to make a relatively simple layout with two adjustment
columns filled with short news pieces, but there's a catch. I cannot
control the html for these news bits, so I am left with CSS only for
positioning etc. My problem is the following. The most natural way to do
what I want is to use "float: left" (or "float: right") for my news bits
and see them all filling the space. However, there's the catch: if the
news bits are allowed to be significantly different in size, then
sometimes "float: left" would leave unnecessarily large spaces on the
left (or, for "float: right", on the right), see the following simple
example:

<html>
<head>
<style type="text/css">
div { border: solid black 1px; }
#box1 { width: 49%; height: 100px; float: left; }
#box2 { width: 49%; height: 200px; float: left; }
#box3 { width: 49%; height: 300px; float: left; }
</style>
</head>

<body>

<div id="box1">1</div>
<div id="box2">2</div>
<div id="box3">3</div>

</body>
</html>

What I really want is to fill in the space under box no. 1. Can I
somehow tell browser to use "float: left or right" (not literally, mind
you :) ), so that the space is filled completely? Are there any other
ways to perform this task that I am not aware of?

Best wishes,
Alex

if the width of your boxes will be fixed .. you could simply use 2
columns, number your news-bits and place the odd in the left columns and
the even in the right. this way your white-space will accumulate at the
end of one column.

gl
martin
Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Chris Beall | last post by:
See http://pages.prodigy.net/chris_beall/BeallSprings/WC.Deed%20GG.116-17.html using the CSS at http://pages.prodigy.net/chris_beall/BeallSprings/BSstyle.css The page is a transcript of a...
6
by: Viken Karaguesian | last post by:
Hello, Just wondering what the difference is between "float" and "align"? If I align a picture to the left, is that not the same as floating it? Can align and float be used together or do you...
4
by: Chris Sharman | last post by:
I've a very simple page (intranet, but moved to http://services.ccagroup.co.uk/dtest.html for you - so the links are all broken). essentially it's just a list of links. I've split it into two...
4
by: Jim West | last post by:
Both int a; std::complex<float> b; std::complex<float> c = static_cast<float>(a)*b; and int a; std::complex<float> b;
5
by: Pat | last post by:
Give two double-typed variable X and Y. If (X==Y) is true, then how about the following results: (float(X) > float(Y))? (float(X) < float(Y))? (float(X) >= float(Y))? ( X > float(Y) )? ( X...
2
by: krsgoss | last post by:
I'm trying to do a two column "form" layout based on article here: http://www.alistapart.com/stories/practicalcss/ The idea is to have a label, and a value using definition list markup. I...
7
by: Dew | last post by:
Hi All The problem is related to strtod()/atof()'s well known behaviour. strtod()/atof() add some extra digits at the end of precision while converting from string to double. Becasue...
13
by: Shirsoft | last post by:
I have a 32 bit intel and 64 bit AMD machine. There is a rounding error in the 8th digit. Unfortunately because of the algorithm we use, the errors percolate into higher digits. C++ code is...
9
by: hurcan solter | last post by:
Hi all, I am trying to convert a float value to a octet stream for transmission, I came up with solution like float deneme=3.14156789; float deneme2=0.0; vector<unsigned charvec; //this is my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...

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.