CSS property float: left inside table?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm trying to design a table that looks like this:

left column    | aaa | bb | cccc | dd | e | ffffff |
some stuff     | g | h | iii | j |
short          | kkkkk | ll | mmmm |
very long text | nn | oooo | p | qqq |

So there is a constant-width left column, but the cells from the second
column on are variable in width.

The second goal I achieved with <div> elements such as this:

div.vari {
 border-width: 2px;
 border-style: solid;
 border-color: black;
 margin: -1px;
 padding: 5px;
 float: left;

Outside a table environment this works, but in order to create the
constant-width left column I created a two-column table, putting the left
content in the first column and the <div>s into the second. This, however,
broke the whole layout. I guess it's the "float: left" bit in the style that
mucks up the table.

Any good ideas on how to solve this?

Another issue: The variable-width divs should have different background
colors. I'd like to use them like this: <div class="vari.red"> or so, and
tried to put something like this:

div.vari.red {
 background-color: red

into the CSS in the hope that div.vari.red would inherit all the other
properties of div.vari. But it doesn't. How can I do this?



Re: CSS property float: left inside table?

Scripsit Robert Latest:

Quoted text here. Click to load it

It doesn't look like a table to me. Why don't you post the URL of the real

Quoted text here. Click to load it


Quoted text here. Click to load it

Huh? How does this relate to the discussion of a table?

Quoted text here. Click to load it

That's not HTML. This group is about HTML.

If you post the URL, someone in this group might be able tell you what is
wrong with your markup. Styling is a different issue, but you should
normally first design adequate markup before considering stylistic

Jukka K. Korpela ("Yucca")

Re: CSS property float: left inside table?

Jukka K. Korpela wrote:

Quoted text here. Click to load it

Oops, sorry, I hadn't found a group containing "css" in its name, but now I
looked again and found the one about "style". I'll re-post my question

I know CSS has nothing to do with HTML and vice versa. In the olden days,
though, CSS issues used to be discussed in this group too.


Site Timeline