Oleksandr IY
Oleksandr IY

Reputation: 3146

make table td so it cannot enlarge

I need to make table td so it cannot enlarge. It should be square and height fixed and if there is more text then can contain a box it should stay as is and the text just go down. Hot to do that?

Upvotes: 0

Views: 168

Answers (5)

Shawn
Shawn

Reputation: 9472

See Set the table column width constant regardless of the amount of text in its cells?

table-layout: fixed;

Here is a jsfiddle that has some HTML changes as well as CSS changes: http://jsfiddle.net/GR4Lm/

I removed some rows to simplify things, but the same technique would apply--wrap all TD contents in a single DIV.

Upvotes: 1

Billy Moat
Billy Moat

Reputation: 21050

I think may do what you're looking for: http://jsfiddle.net/rVDQm/

table tr td {
 width:400px;
 height:400px;
 background:#ccc;
 overflow:scroll;
 overflow-x:hidden;
 display:block;
}

Upvotes: 0

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114447

Add a DIV in each TD and add overflow:hidden for that element's style and give it fixed dimensions.

Upvotes: 0

fwho
fwho

Reputation: 248

    td style="height:xpx; width:xpx; overflow:auto;"

Upvotes: 0

GiantDuck
GiantDuck

Reputation: 1064

Assuming I understand your question correctly, use max-height and max-width in your CSS.

Upvotes: 0

Related Questions