Tables Don't Display Properly

1) I create a new page
2) For input format I select full htmls
3) I insert a table
4) But when the table displays, the width seems to "expand" to fit the page (despite the html code)

Click here to see sample WYSIWYG graphic

Click here to see html source.


Comments

dman’s picture

that HTML is wrong in several ways.

  • Using tables :) natch
  • I guess you mean 100% not 100(pixels)
  • If you wanted width 100%, the contents columns should be 50%, each, not 100, do your maths
  • height=100% will not work very consistantly over browsers

Basically, you've got a lot of fiddling to do to learn best practices for HTML these days.

Check your actual html source that gets output to the page, I don't trust wysiwyg, and if anything, if it's really stripping any parameters, this issue should be posted to the respective wysiwyg module project.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

jbraun’s picture

Despite de-activating the wysiwyg editor and using the code below, my table still "expands" to fill the entire page:


<table width="15" border="2">
    <tbody>
        <tr>
            <td width="5%">A</td>
            <td width="5%">B</td>
            <td width="5%">C</td>
        </tr>
    </tbody>
</table>

Any other ideas? Seems like strange behavior.

dman’s picture

Is that code what you think you've entered, or what actually gets sent to your view-source? Sometimes output filters get in the way and strip away bits you expect to see.

Your maths is still screwy in that code you pasted. There can be times when you want to mix & match absolute pixels and dodgy percentages, but that requires a bit of code-fu.

You are theoretically wanting the tds to be 5% of their containing layout element - which is the table itself. you are asking for 5% of 15 pixels. - 3/4 of 1 pixel.

No, that doesn't work either, but you've got bigger problems. Check some HTML handbooks, alistapart has the guru articles.

Save a static html version of the page and tweak that by hand until you've solved it

Only then take it back and see if it's Drupal or the wysiwyg that may be causing you problems

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

jbraun’s picture

As it turns out, the problem wasn't with the code. It was with the theme. As soon as I switched to Marvin it worked. Switching back to Garland produced the strange behavior (resizing tables to full size). Just curious . . . .why does the html work with only certain themes?

Thanks for your help Dan.

Josh

dman’s picture

along with the theme html comes theme css.
Sometimes that theme css may conflict with what you are wanting.
eg if Garland/style.css has table{width:100%} or something more mysterious with the position or float of containing elements, it requires fiddling.
That said - your hard-coding of a width into a table html should have over-ridden all css.

Use "View Styles" to track down which rules are in effect for your trouble spots.

.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/

jbraun’s picture

Thanks Dan.