PleaseHelpMe
PleaseHelpMe

Reputation: 739

How to make an HTML <button> vertifically fill a Table Cell with CSS?

How can I make an HTML <button> vertifically fill a Table Cell with CSS?

I can use width:100% to make the button horizontally fill a Table Cell with CSS, but height:100% doesn't do anything.

For an example, please see: http://jsfiddle.net/eA5fQ/

Thanks!

Upvotes: 8

Views: 12952

Answers (4)

DerBesondereEin
DerBesondereEin

Reputation: 470

Add height:100%; to your button and set height of your td tag in percents

Upvotes: 3

penguinrob
penguinrob

Reputation: 1459

If you use min-height: 1px; as well as height: 100%; it seems to work fine: http://jsfiddle.net/jJbCd/8/

Upvotes: -2

jrn.ak
jrn.ak

Reputation: 36619

If you don't mind a jQuery solution:

$('#button1').css('height', $('#button1').parent('td').height());

Live Demo

Upvotes: 4

Ken Pespisa
Ken Pespisa

Reputation: 22266

You'll need to specify the height in pixels as in:

height: 100px;

Upvotes: 3

Related Questions