You are here: Re: Can you force a 'break-word' wrap on a td without specifying its width? « HTML « IT news, forums, messages
Re: Can you force a 'break-word' wrap on a td without specifying its width?

Posted by Ben C on 11/03/06 09:44

On 2006-11-03, Toby Inkster <usenet200610@tobyinkster.co.uk> wrote:
> Jim Moe wrote:
>
>> "overflow:hidden" (CSS) is not an attribute you can apply to a table
>> cell directly.
>
> Why not?
>
> http://www.w3.org/TR/CSS21/visufx.html#overflow
>
>: 'overflow'
>:
>: Value: visible | hidden | scroll | auto | inherit
>: Initial: visible
>: Applies to: non-replaced block-level elements, table cells,
>: and inline-block elements
>: Inherited: no
>: Percentages: N/A
>: Media: visual
>: Computed value: as specified

Good question.

It just is part of the way that the big browsers format tables, that
they never allow a cell to be narrower than its content minimum width,
even if that means making the cell wider than a width you've asked for,
and even if it means making the whole table wider.

This isn't required by the CSS 2.1 spec as far as I can see, but it's
what they all do.

This makes overflow: hidden immaterial on a table-cell. You can set it,
but it won't make any difference, because they never overflow.

There is a way to achieve the effect of overflowing table cells by
putting divs inside the table cells and setting width and overflow on
those instead. e.g.:

<head>
<style type="text/css">
table
{
font-size: large;
border: 1px solid red;
}
td
{
border: 1px solid black;
}
div
{
width: 100px;
overflow: hidden;
}
</style>
</head>
<body>
<table>
<tr>
<td>
<div>
chalchenteric
</div>
</td>
<td>
<div>
perspicacious
</div>
</td>
<td>
<div>
trichloromethylisothiazilone
</div>
</td>
</tr>
</table>
</body>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация