473,614 Members | 2,321 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

floated elements inside table cell do not contribute to cell width?

Hello there again!

On my quest to remove layout tables in favor of CSS controlled elements,
I am faced with quite a problem.

A table cell that has no explicit width attribute set usually
adapts its width to accommodate the content nicely.

This is not the case when the content contains floats. I guess floats do
not contribute to the table cell width as floated elements are taken out
of the flow of the document and thus take up no space.

Please have a look at my test case here:

http://www.mobotixserver.de/~daniel/..._float_en.html

The last table on the page is contains floats. In the upper right table
cell, text covers floated elements even though the browser window is
large enough to accommodate a larger table width.

How can I have the browser respect the floats when calculating the
table width so that all elements can be placed next to each other?

Cheers
Daniel
Sep 4 '06 #1
9 2601
Daniel Kabs <da*********@gm x.dewrote:
>I guess floats do
not contribute to the table cell width as floated elements are taken out
of the flow of the document and thus take up no space.
A float in a table cell will stretch the cell's width and height.

--
Spartanicus
Sep 4 '06 #2
Hello!

Spartanicus wrote:
A float in a table cell will stretch the cell's width and height.
This may be true for *one* float, but what about having several floats
in the cell? At least the floats in my example (last table on the page)

http://www.mobotixserver.de/~daniel/..._float_en.html

do not stretch the cell's width.

How do I get the floats arranged next to each other so that the cell's
width is stretched and text does not overlap the floated buttons,
without setting fixed sizes?

Thanks for your help,

Cheers
Daniel

Sep 5 '06 #3
Daniel Kabs <da*********@gm x.dewrote:
>A float in a table cell will stretch the cell's width and height.

This may be true for *one* float, but what about having several floats
in the cell?
Same.
>At least the floats in my example (last table on the page)

http://www.mobotixserver.de/~daniel/..._float_en.html
The quality of the help available here increases significantly if you
allow us to see what it is that you are actually trying to do (minimised
to only the relevant bit), instead of presenting bogus "some text"
content.

--
Spartanicus
Sep 5 '06 #4
Hello Spartanicus,

thanks for answering.

Spartanicus wrote:
>This may be true for *one* float, but what about having several floats
in the cell?

Same.
Granted, the cell dimensions will increase to incorporate all floated
elements.

Problem is, the arrangement of several floats inside a cell is not
completely controllable, e.g. you can not have all floats on one line
although the browser window is big enough. At least this is my finding
after experimenting with floats.
>At least the floats in my example (last table on the page)

http://www.mobotixserver.de/~daniel/..._float_en.html

The quality of the help available here increases significantly if you
allow us to see what it is that you are actually trying to do (minimised
to only the relevant bit), instead of presenting bogus "some text"
content.
You are insinuating that my example is a bloated mess, a tag soup that
you deservedly declined to decrypt. I am sorry if you got that
impression. Believe me, I put several hours of work into that page to do
exactly what you are asking for: describe the problem using reduced test
cases. Therefore I used "bogus text". I think that's typical for test
cases and examples. Of course, I could have used the "lorem ipsum" dummy
text instead :-)

I think, you did not read through my page. The page describes *what* I
am trying to do, then gives some *working examples* (using tables) and
then tries to give some solutions (using CSS), which are the best I
could think of.

What more information do you need? I am happy if I can improve the page
to describe the problem more clearly.

Cheers
Daniel
Sep 5 '06 #5
Daniel Kabs <ne********@kab si.dewrote:
>>This may be true for *one* float, but what about having several floats
in the cell?

Same.

Granted, the cell dimensions will increase to incorporate all floated
elements.

Problem is, the arrangement of several floats inside a cell is not
completely controllable, e.g. you can not have all floats on one line
although the browser window is big enough. At least this is my finding
after experimenting with floats.
You probably have a misconception about floats. Floating is not a
correct method to align elements or to create a "layout". Sadly floating
is often used for these purposes, but it's a hack which often causes
nasty problems, and when used for such inappropriate purposes they often
are a pain to work with.
>>At least the floats in my example (last table on the page)

http://www.mobotixserver.de/~daniel/..._float_en.html

The quality of the help available here increases significantly if you
allow us to see what it is that you are actually trying to do (minimised
to only the relevant bit), instead of presenting bogus "some text"
content.

You are insinuating that my example is a bloated mess, a tag soup that
you deservedly declined to decrypt.
I implied no such thing.
>I am sorry if you got that
impression. Believe me, I put several hours of work into that page to do
exactly what you are asking for: describe the problem using reduced test
cases. Therefore I used "bogus text". I think that's typical for test
cases and examples. Of course, I could have used the "lorem ipsum" dummy
text instead :-)

I think, you did not read through my page. The page describes *what* I
am trying to do, then gives some *working examples* (using tables) and
then tries to give some solutions (using CSS), which are the best I
could think of.

What more information do you need? I am happy if I can improve the page
to describe the problem more clearly.
It helps considerably if we are allowed to see the problem, not
someone's idea of the solution since that prevents us from checking if
the best solution was chosen.

Your example doesn't show us anything about what you are actually trying
to do. All it demonstrates is that you are trying to emulate table
properties. This can be done using CSS, but it is rarely a good idea to
do so. Table layouts have a bad reputation for the problems they cause,
so what is the point of emulating all those problems with CSS? If you
want to move away from table layouts then you are going to have to adapt
a new way of thinking.

Now how are we supposed to suggest a good way forward if as in your case
all we can learn from your demo is that you want to emulate tables?

--
Spartanicus
Sep 5 '06 #6
Good Morning!

Spartanicus wrote:
You probably have a misconception about floats. Floating is not a
correct method to align elements or to create a "layout". Sadly floating
is often used for these purposes, but it's a hack which often causes
nasty problems, and when used for such inappropriate purposes they often
are a pain to work with.
Understood. Now what is the correct method to align block elements on
one line, say one element to the left, one to the right? We had this
discussion a few days ago over in German group dciwa.misc. There, people
suggested either to float the elements or to position the elements. The
latter bears the drawback that the elements had to be given sizes to
prevent overlapping. What is your suggestion?
It helps considerably if we are allowed to see the problem, not
someone's idea of the solution since that prevents us from checking if
the best solution was chosen.
Maybe you are too skilled to see the problem. :-) On the other hand, if
I hadn't given any solution by myself, someone might have complained
that I am lazy as I did not even try to solve the problem on my own.
Your example doesn't show us anything about what you are actually trying
to do.
I can not concur. The examples on the page ("Original using nested
layout table") present the layout (arrangement of text and buttons) I
want to achieve.

Granted, I implemented the examples using tables. Why did I use tables?
Because I do not know of any other way to achieve the layout currently.
I could have used screenshots instead but they lack the dynamic behaviour.
All it demonstrates is that you are trying to emulate table
properties.
I am trying to emulate a *layout* through the use of CSS. The fact that
(on the page) the desired layout was presented using a table should not
mislead you. The nested table is only a means of presenting the desired
layout. As I said, I could've used screenshots instead. But that's not a
good idea, I thought.
Cheers
Daniel
Sep 5 '06 #7
Daniel Kabs <ne********@kab si.dewrote:
>Your example doesn't show us anything about what you are actually trying
to do.

I can not concur.
I am not wasting my time on someone who isn't willing to let me see what
he is actually trying to do, bye.

--
Spartanicus
Sep 5 '06 #8
Hi again!

Spartanicus wrote:
I am not wasting my time on someone who isn't willing to let me see what
he is actually trying to do, bye.
I described the problem in several postings and crafted a web page with
examples describing the layout I want to achieve. And you call me
"unwilling" ?

What more do you need?
What else do you want to see?
What did you understand so far?

Cheers
Daniel
Sep 6 '06 #9
Hi,

I will try my best to help you get some help. :)

Daniel Kabs a écrit :
Spartanicus wrote:
It helps considerably if we are allowed to see the problem, not
someone's idea of the solution since that prevents us from checking
if the best solution was chosen.
[...]
Your example doesn't show us anything about what you are actually
trying to do.

I can not concur. The examples on the page [...] present the layout
[...] I want to achieve.
Granted, but we need to know a bit of the "big picture" to give a
meaningful and useful answer. Your question is very accurate, too
narrow indeed, something along the line of "how can I get a row of
buttons in the upper right cell of a table ?".

If you intend to use your 4-cell table as a page layout, use one page
per attempt; put a (random) picture where a picture (i.e., a logo) will
eventually be, put short texts where there will be a menu, include a
full lorem ipsum paragraph where you plan to put your articles. And
then we can point you to a tested-and-proven two-column CSS layout on
the web. ;-) Or try and fix any additional problem you may encounter.

Best of luck,
-- Daniel
Sep 6 '06 #10

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

Similar topics

1
2390
by: Graham J | last post by:
I submitted a variation on this on the Opera forum but I thought I'd bring it up here too as a more general HTML query. Consider this code (I've shown it the old fashioned presentational way but the same problem would happen with CSS): <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Changed behaviour in Opera 7.21</title>
26
3762
by: puzzled | last post by:
Okay, so my subject sounds a bit crass. As much as I'd like to totally embrace css and avoid "deprecated" usage, sometimes the deprecated stuff is so much easier and more effective. Plus, it at least does what I want it to, while I'm left puzzled trying to make a css implementation do the same thing. Here is a simple example. I want to have four identical-sized images displayed in a two-by-two arrangement, wtih room for a centered...
3
2852
by: Lee K. Seitz | last post by:
I'm redesigning this page for more up-to-date browser standards: <http://home.hiwaay.net/~lkseitz/hhs/winners.shtml>. Note the use of an "invisible" table to position the "visible" ones. I'm attempting to get a similar layout using CSS. So far the best I've come up with is <http://home.hiwaay.net/~lkseitz/hhs2/winners.shtml>. (CSS at <http://home.hiwaay.net/~lkseitz/hhs2/hhs.css>.) The problems (all Windows): 1. In IE 6 and NN 7,...
24
2873
by: Thomas Mlynarczyk | last post by:
Hi, Here's what I have: <div> <img ...><br> Caption text </div> The div is floated left and has no width set, the content is centered, there are no margins or padding on the <img> (just a bottom margin and
3
6109
by: yawnmoth | last post by:
I'm trying to center list elements in a webpage I'm working on, and setting margin-left to auto for ol (or ul) seems to prevent the number (or bullet) from displaying in IE6 (strict mode) and Opera7 (it works fine in Firefox). Any ideas as to why and what I might do to fix it? I've set up a little demonstration of the problem here: http://www.frostjedi.com/terra/dev/test.html It's set up to render in quirks mode to demonstrate that it...
4
9527
by: Matt | last post by:
Hi, Got an unordered list with 100% width, with 5 list items of 20% width styled to fill the width of the container element. Renders fine in Mozilla, but when you change the size of the window in IE, the last item in the list has a nasty tendency to wrap down to the next line (and stay there). I can hack it (imperfectly) by setting the width of the list items to
17
2754
by: Alex Blekhman | last post by:
Hello, I'm experienced Windows programmer, however, I'm quite novice in HTML technologies. Recently I was assigned a task to write small utility for internal use in our development team. I chose to write its GUI in HTML and make front end as HTA. While developing application's logic is no problem the HTML layout and properties require some additional efforts. So, I
3
2285
by: robert.oschler | last post by:
I have an AJAX driven page where I dynamically add rows to a known table on the page, based on the return document from the AJAX call, using DOM node methods (except for a small snippet of code, see below) .. The code I use to do that is shown below. The code runs fine in FireFox. I can see the newly created table rows and everything looks fine on the page. In Internet Explorer, I don't see any changes to the page after the new nodes...
13
3292
by: Stevo | last post by:
I've found that for IE6+, if you add the property text-align:center to a DIV, then *anything* inside it gets centered. That can be a table, an object/embed, another DIV, an image, or some text. Firefox and Safari on the other hand don't treat text-align in that way. In my tests on those browsers, they only centers images and text. Any DIVs, object/embeds or tables remain default unaligned and generally appear on the left. Considering...
0
8197
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8640
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5548
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4136
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2573
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.