Forum Moderators: open

Message Too Old, No Replies

Empty span tag height

         

edacsac

8:53 pm on Dec 5, 2005 (gmt 0)

10+ Year Member



Hi all,

I'm looking for a solution to remove the space a <span> tag uses.

I have a table in a page where each table row is embedded within a span tag, and the style for each span tag is set to display based on whether or not a checkbox is checked, using javascript. If the span tag is set NOT to display, the span still uses space, and if several span tags are set not to display consecutively, it produces a blank block.

Is there anything I can do to supress the height of an emptly span tag?

Robin_reala

9:43 pm on Dec 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's wrong with setting the display property of the row directly? From the sounds of it you're wrapping each row inside a span which isn't valid HTML.

Wrt the actualy problem, are you setting display none or visibility hidden? Visibility hidden will only make the element invisible but not remove it from the page.

edacsac

10:57 pm on Dec 5, 2005 (gmt 0)

10+ Year Member



I'm sure its not valid html. I'm setting the visibility to none. I tried setting visibility to none on the actual <tr> like your suggesting, but it doesn't turn on with the javascript. The javascript is just changing the visibility to 'block' via the tag id.

Robin_reala

7:36 am on Dec 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to set the display property of the span to 'none' and back to 'block' again. If you're applying display directly to the table row then the desiplay property will need to be 'none'/''. '' because it signifies go back to the default value. Default value should be 'table-row' but IE needs 'block' for some reason.

edacsac

2:13 pm on Dec 6, 2005 (gmt 0)

10+ Year Member



I am toggling the display property between "none" and "block". Does this mean it won't work on the table row and needs to be done with span?

edacsac

3:04 pm on Dec 6, 2005 (gmt 0)

10+ Year Member



Scratch that. I redid everything this morning adding the function to the table row like you suggested, and it works great. Thanks for your help Robin_reala!

Robin_reala

3:58 pm on Dec 6, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, good. Glad that helped.