how to edit a table?

Subscribe to how to edit a table? 7 posts, 5 voices

 
firefoxftw User

I'm almost done with a script but I'm stuck.

I want to edit this:
<table class="calendar" width="100%">

To
<table class="calendar" height="98%" width="100%">

How can I do this?

btw, this is my first script.</table></table>

 
Descriptor Scriptwright

There is no "height" for tables: http://www.w3.org/TR/html401/struct/tables.html...
So changing it will likely have no effect.

 
Aquilax Scriptwright

I think that you can do it with the style attribute but I'm not sure of it, you must test it: style="height: 98%;"

 
gollum Scriptwright

You could make it 98% by having a cssRule table.calendar {margin-top: 1%; margin-botom: 1%;}

or

<table class="calendar" width="100%" style="margin-top: 1%; margin-botom: 1%;">

The 98% will be relative to tables container

 
Descriptor Scriptwright

Why add style attribute when you have a class name?
GM_addStyle("table.calendar {margin: 1% auto}");
or use Stylish.

You can use min-height for a table, but you'll have to define a few other things, likely vertical-align: bottom; padding: auto; and maybe min-height for each cell, and there is no definition for "percentage" in table or cell heights. However you could use em which refers to line height (or width of "M", and ex is height of "x"), but is equal to the font size. I haven't messed with it much since it's totally inconsistent across browsers.

 
Mikado Scriptwright

Descriptor wrote:

There is no "height" for tables: http://www.w3.org/TR/html401/struct/tables.html... So changing it will likely have no effect.

setAttribute still works.
 
firefoxftw User

Thanks for all the help. I got it to work by using:
GM_addStyle("table.calendar {height: 98%}");