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

How do I stop "floats" from floating

Hi,

I have a row of 5 <DIVelements that have the "float: left" attribute
as I wanted them on the same row. I issue a "clear: left" for the
subsequent element.

All looks great except if I increase the browser text size of contract
the screen, the last DIV floats underneath. Is there anyway to stop
this and keep all on the same row?

Thanks,
Don
Jun 27 '08 #1
13 4244
donpro meinte:
Hi,

I have a row of 5 <DIVelements that have the "float: left" attribute
as I wanted them on the same row. I issue a "clear: left" for the
subsequent element.

All looks great except if I increase the browser text size of contract
the screen, the last DIV floats underneath. Is there anyway to stop
this and keep all on the same row?
Not really. Since the observed "phenomenon" is how floats work. Perhaps
you can enlarge the container containing the floats (or scale it in
"em", too).

Gregor
--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Jun 27 '08 #2
On 05/27/08 08:15 am, donpro wrote:
>
I have a row of 5 <DIVelements that have the "float: left" attribute
as I wanted them on the same row. I issue a "clear: left" for the
subsequent element.

All looks great except if I increase the browser text size of contract
the screen, the last DIV floats underneath. Is there anyway to stop
this and keep all on the same row?
Wrap them in another div of a fixed width set with ems.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jun 27 '08 #3
On 27 May, 16:15, donpro <donpro-2...@rogers.comwrote:
All looks great except if I increase the browser text size of contract
the screen, the last DIV floats underneath. Is there anyway to stop
this and keep all on the same row?
This is what float does. If you want to force the grid positioning,
even when it no longer fits into the window size, then use a <table>
instead.

Read http://brainjar.com/css/positioning/ for a good article of float
too.
Jun 27 '08 #4
Jim Moe wrote:
On 05/27/08 08:15 am, donpro wrote:
>>
I have a row of 5 <DIVelements that have the "float: left" attribute
as I wanted them on the same row.
Wrap them in another div of a fixed width set with ems.
FYI, ems are not a one-size-fits-all unit.

It wouldn't be the best unit to use unless the content were all text,
and it's debatable even then. % units would allow the widths to scale to
the window size, and px should be used for graphical content.

The best unit to use depends on the specific content and the overall
design/layout.

If the OP posted a URL it would be easier to make a suggestion for his
particular case.

--
Berg
Jun 27 '08 #5
On 28 Mai, 17:48, Bergamot <berga...@visi.comwrote:
Jim Moe wrote:
On 05/27/08 08:15 am, donpro wrote:
I have a row of 5 <DIVelements that have the "float: left" attribute
as I wanted them on the same row.
* Wrap them in another div of a fixed width set with ems.

FYI, ems are not a one-size-fits-all unit.
So use Inch, inch is a one-size-fits-all unit. On normal screens
an inch is the same or a little bigger than one inch. It depends
on your configuration. On a cellurar phone or a pda, an inch is
not an inch, but something that looks like an inch (considering
that you are holding the device closer to your eyes, and con-
sidering that the letters has to be at least 8-9 pixels height). It
would be different from device to device. But the idea isn't mine.
Teoretical the graphical would match the letters, but that would
never happen.
>
It wouldn't be the best unit to use unless the content were all text,
and it's debatable even then. % units would allow the widths to scale to
the window size, and px should be used for graphical content.
How come? Isn't that defined in css? I would think that 100% is 100%
of the containing element. So how would that differ?
>
The best unit to use depends on the specific content and the overall
design/layout.
I think most can agree with that.
>
If the OP posted a URL it would be easier to make a suggestion for his
particular case.
If the OP postet an URL, we all could use ower effort to criticise the
content.
That would be nice.
Jun 27 '08 #6
On 28 Mai, 11:48, Andy Dingley <ding...@codesmiths.comwrote:
On 27 May, 16:15, donpro <donpro-2...@rogers.comwrote:
All looks great except if I increase the browser text size of contract
the screen, the last DIV floats underneath. *Is there anyway to stop
this and keep all on the same row?

This is what float does. If you want to force the grid positioning,
even when it no longer fits into the window size, then use a <table>
instead.
For once I agree with Andy Dingley. If you want a table layout, use
tables. In most cases thats better than emulatin tables with div-
elements.
Don't rely on lynx or text-emulation if you are trying to design
accessible
sites. Most, and every "disabled" person is using a screen reader on
top
of an ordinary webbrowser. It can't be that hard to download and try
out
one for yourself. If you've tryed one, you know that now one is
tabbing around
and hope for some interesting to appear.
>
Readhttp://brainjar.com/css/positioning/for a good article of float
too.
Also remember, its's considered best practice to read htmldog.com.
Jun 27 '08 #7
On 05/28/08 08:48 am, Bergamot wrote:
>>>
I have a row of 5 <DIVelements that have the "float: left" attribute
as I wanted them on the same row.
Wrap them in another div of a fixed width set with ems.

FYI, ems are not a one-size-fits-all unit.
The OP mentioned changing the text size and having the layout degrade. I
assumed he has text in the divs making ems an appropriate unit to recommend.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jun 27 '08 #8

Jim Moe wrote:
On 05/28/08 08:48 am, Bergamot wrote:
>>>>
I have a row of 5 <DIVelements that have the "float: left" attribute
as I wanted them on the same row.

Wrap them in another div of a fixed width set with ems.

FYI, ems are not a one-size-fits-all unit.
The OP mentioned changing the text size and having the layout degrade. I
assumed he has text in the divs making ems an appropriate unit to recommend.
I guess I missed that part, but it doesn't change the fact that a fixed
width in ems may not be the best thing to do. It depends on the content.

There's another thread in here someplace about a layout with a fixed
width of 60ems. Bad, bad idea, except for people using small default
font sizes.

--
Berg
Jun 27 '08 #9
Roy A. wrote:
On 28 Mai, 11:48, Andy Dingley wrote:
>
>Readhttp://brainjar.com/css/positioning/for a good article of float
too.

Also remember, its's considered best practice to read htmldog.com.
That's kind of an overstatement, isn't it?

You make it sound like it overshadows the Bible and Koran.

--
John
"And now, my children, let us turn to the Book of Margins, chapter 2,
verse 1."
Jun 27 '08 #10
John Hosking wrote:
Roy A. wrote:
>On 28 Mai, 11:48, Andy Dingley wrote:
>>
>>Readhttp://brainjar.com/css/positioning/for a good article of float
too.

Also remember, its's considered best practice to read htmldog.com.

That's kind of an overstatement, isn't it?

You make it sound like it overshadows the Bible and Koran.
How so? To me it looks like a recommendation to learn about some
technical issues at a website.
--
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project -- http://improve-usenet.org
Found 5/08: a free GG-blocking news *feed* -- http://usenet4all.se

Jun 27 '08 #11
Roy A. meinte:
Also remember, its's considered best practice to read htmldog.com.
It is? Despite doing web authoring for quite some time now, I haven't
even heard of that site.

Gregor
--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Jun 27 '08 #12
Blinky the Shark wrote:
John Hosking wrote:
>Roy A. wrote:
>>On 28 Mai, 11:48, Andy Dingley wrote:
Readhttp://brainjar.com/css/positioning/for a good article of float
too.
Also remember, its's considered best practice to read htmldog.com.
That's kind of an overstatement, isn't it?

You make it sound like it overshadows the Bible and Koran.

How so? To me it looks like a recommendation to learn about some
technical issues at a website.
Yeah, sure, that's understood, but: *best* practice?

It's better than any other tutorial or discussion site, better than
referring to the W3C's pages, better than
trial-and-error-and-validate-experimentation, better than these here
newsgroup thingies, better than thinking globally and acting locally,
better than treating others as you would have them treat you (etc.)?

If he had said "it's good practice" in the three places he's dropped
this phrase lately, I wouldn't have wasted the post on it. I *agree*
with *that* .

--
John
Better even than the UIP: http://improve-usenet.org/ ? ;-)
Jun 27 '08 #13
John Hosking wrote:
Blinky the Shark wrote:
>John Hosking wrote:
>>Roy A. wrote:
On 28 Mai, 11:48, Andy Dingley wrote:
Readhttp://brainjar.com/css/positioning/for a good article of float
too.
Also remember, its's considered best practice to read htmldog.com.
That's kind of an overstatement, isn't it?

You make it sound like it overshadows the Bible and Koran.

How so? To me it looks like a recommendation to learn about some
technical issues at a website.

Yeah, sure, that's understood, but: *best* practice?
So is not using tables for nontabular material. That hardly ranks the
advice up with the relious canons. Canona. Canonae. Whatever.
It's better than any other tutorial or discussion site, better than
referring to the W3C's pages, better than
trial-and-error-and-validate-experimentation, better than these here
newsgroup thingies, better than thinking globally and acting locally,
better than treating others as you would have them treat you (etc.)?
Then it sounds like "best practice" to me.
If he had said "it's good practice" in the three places he's dropped
this phrase lately, I wouldn't have wasted the post on it. I *agree*
with *that* .
I see you didn't recommend anything better. So I guess "best" still works.

--
Blinky
Killing all posts from Google Groups
The Usenet Improvement Project -- http://improve-usenet.org
Found 5/08: a free GG-blocking news *feed* -- http://usenet4all.se

Jun 27 '08 #14

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

Similar topics

18
by: day | last post by:
I know I've seen this issue described before, but I can't find it, or the solution now that I need it. I have some css-specified floating divs that contain images or text. The text divs have a...
13
by: Alf P. Steinbach | last post by:
The third part of my attempted Correct C++ tutorial is now available, although for now only in Word format (use free Open Office if no Word), and also, it's not yet been extensively reviewed -- ...
59
by: Pierre Quentel | last post by:
Hi all, In some program I was testing if a variable was a boolean, with this test : if v in My script didn't work in some cases and I eventually found that for v = 0 the test returned True ...
11
by: Russ | last post by:
I have a couple of questions for the number crunchers out there: Does "pow(x,2)" simply square x, or does it first compute logarithms (as would be necessary if the exponent were not an integer)?...
1
by: Peter Knörrich | last post by:
Hello, I've found another inconsistency, and looking through the list archives I can find mentions of funky stuff like print float('inf') giving Infanity
6
by: Jeffrey Goldberg | last post by:
I suspect that this is a common problem (and so with a known solution/work-around), but my attempts to find it have failed. I have a float (a table of content box) on the left of a page. The...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
10
by: mdh | last post by:
Quick question about pointers. Wrote this "trying to understand this better" code: int *ptr, x = 565; ptr= &x; printf("\n\n\nThe value of x is %d\n", x);
12
by: Michael7 | last post by:
Hi Everyone, I've been trying to get two blocks of text to be aligned, one left, one right, on the same line. What I'm trying to mimic is what I did with tables here: ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.