Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Problem with table cell width

Reply
Thread Tools

Problem with table cell width

 
 
=?ISO-8859-1?Q?L=FCpher_Cypher?=
Guest
Posts: n/a
 
      03-27-2005
Hi,

I have a table like this:

<table cellspacing="0" cellpadding="0">
<tr>
<td style="padding:2px 4px 2px 4px;width:16px;">
<img src="..." style="width:16px;height:16px;" />
</td>
<td style="padding:2px 4px 2px 4px;border-left:1px solid #000000;">
Some text
</td>
</tr>
<tr>
<td colspan="2">
Some text
</td>
</tr>
</table>

From the code above I expect a table with 2 cells in the first row,
separated by a line, with the first one being 16px (or adjusted to fit
the image), and the second one takeing the rest of the width of the table.
Now, if I load that in Firefox/NS, it works fine, but in IE for some
reason the first cell stretches more than needs to be. I could set
table-layout:fixed and adjust width:20px, but then the table takes 100%
of available width, and I need its width to be adjusted to content in
the second row (if it's longer than the first row).
Anyone has ideas how to fix it in IE?

Thanks,
Lüph
 
Reply With Quote
 
 
 
 
Lauri Raittila
Guest
Posts: n/a
 
      03-27-2005
in alt.html, =?ISO-8859-1?Q?L=FCpher_Cypher?= wrote:
> Hi,
>
> I have a table like this:


Looks layout table. If it is not, give URL. Or if it is, and you want
help, give URL.

> but in IE for some reason the first cell stretches more than needs to be.


Yes, why wouldn't it? That is explicitly allowed in CSS21, IIRC.

> I could set table-layout:fixed and adjust width:20px, but then the table
> takes 100% of available width,


On IE, you mean...

> and I need its width to be adjusted to content in the second row


Yes.

Easiest way to solve is not use table. If it is not layout table, give
URL, and someone might find solution.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?L=FCpher_Cypher?=
Guest
Posts: n/a
 
      03-29-2005
Lauri Raittila wrote:
> in alt.html, =?ISO-8859-1?Q?L=FCpher_Cypher?= wrote:
>
>>Hi,
>>
>>I have a table like this:

>
>
> Looks layout table. If it is not, give URL. Or if it is, and you want
> help, give URL.


Well, I'm doing everything on a local machine now. But basically, I'd
like to have something that looks like a window: a title bar with an
icon and a place to put the content in. The only thing is that I use
icons 16x16px and want them to be separated by a vertical bar from the
actual title:

+--------+-------------...
| [Icon] | Some title...
+--------+-------------...
| Some content...
+----------------------...

So, I naturally thought of a table. The thing is, that I don't always
want to set table width. But I want the icon/title separator to be right
after the icon (for which I can simply set border-right or border-left).
So that's why I set the first cell's width:16px, but in IE it stretches
more.

>
>
>>but in IE for some reason the first cell stretches more than needs to be.

>
> Yes, why wouldn't it? That is explicitly allowed in CSS21, IIRC.


Should it really, if I explicidly set its width?


Lüph
 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      03-29-2005
Lüpher Cypher wrote:

> +--------+-------------...
> | [Icon] | Some title...
> +--------+-------------...
> | Some content...
> +----------------------...
>
> So, I naturally thought of a table.



What about:

<div class="story">
<h2><img src="icon" alt="">
Some title...</h2>
<p>Some content</p>
</div>

..story {
border: 2px solid black;
}
..story h2 {
font-size: 133%;
background: black;
color: white;
}
..story p {
margin: 0.5em 1em;
}

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

 
Reply With Quote
 
Lauri Raittila
Guest
Posts: n/a
 
      03-29-2005
in alt.html, =?ISO-8859-1?Q?L=FCpher_Cypher?= wrote:
> Lauri Raittila wrote:
> > in alt.html, =?ISO-8859-1?Q?L=FCpher_Cypher?= wrote:
> >
> >>Hi,
> >>
> >>I have a table like this:

> >
> >
> > Looks layout table. If it is not, give URL. Or if it is, and you want
> > help, give URL.

>
> Well, I'm doing everything on a local machine now. But basically, I'd
> like to have something that looks like a window: a title bar with an
> icon and a place to put the content in. The only thing is that I use
> icons 16x16px and want them to be separated by a vertical bar from the
> actual title:
>
> +--------+-------------...
> | [Icon] | Some title...
> +--------+-------------...
> | Some content...
> +----------------------...
>
> So, I naturally thought of a table.


Why? it obviouly is not table...

IMHO, this would be much more logical markup:

<div><img><hN>title</hN>
<p>Content
</div>

hN {display:inline;border-left:1px solid #000;}

> The thing is, that I don't always want to set table width.


So, don't set it.

> But I want the icon/title separator to be right
> after the icon (for which I can simply set border-right or border-left).


Why can't you use border-left for title?

> So that's why I set the first cell's width:16px, but in IE it stretches
> more.


As does NN4... And modern browsers as well on certain cases.

> > Yes, why wouldn't it? That is explicitly allowed in CSS21, IIRC.

>
> Should it really, if I explicidly set its width?


No, it there is no requirement of streching it, but it is allowed. Makes
sence, as long as you use table for tabular data. Makes no sence on
layout table, but that is pretty irrelevant...

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
table, cell width and javascript problem kaston3 HTML 2 07-18-2006 09:03 AM
Cell width error when containing variable width content mj.redfox.mj@gmail.com HTML 0 01-26-2006 03:37 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM
Table width and columns width kris HTML 11 11-18-2003 06:49 AM
Re: resized image in table extends table width to original image width Sean Jorden HTML 1 08-19-2003 08:59 AM



Advertisments