Opened 11 years ago
Closed 6 years ago
#32548 closed defect (bug) (worksforme)
Unecessary White Space Above Table
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Formatting | Keywords: | |
| Focuses: | Cc: |
Description
This may be a known problem but this is the first time I've discovered it. I have found that if I put a table on a page in this format:
<TABLE>
<TR>
<TD>xx</TD><TD>yy</TD></TR>
<TR><TD>11</TD><TD>22</TD></TR>
<TABLE>
WordPress will generate a number of unnecessary lines of white space prior to the table. If I remove the white space between the HTML elements so that it looks like this the problem of the unnecessary white space prior to the table goes away but the code looks like crp, of course:
<TABLE><TR><TD>xx</TD><TD>yy</TD></TR><TR><TD>11</TD><TD>22</TD></TR><TABLE>
Here's a link that led me to the solution to this problem::
https://en.forums.wordpress.com/topic/extra-spaces-on-top-of-tables
The above post was from 2007 yet this problem still exists. Is everyone aware of this problem? Is there a solution?
Thanks,
Change History (5)
#1
@
10 years ago
- Component changed from General to Editor
- Keywords reporter-feedback added
- Version 4.2.2 deleted
#2
@
10 years ago
Here are the exact steps I used to reproduce this problem:
- Create a new page
- In the new page, paste the following HTML:
<TABLE>
<TR>
<TD>xx</TD><TD>yy</TD></TR>
<TR><TD>11</TD><TD>22</TD></TR>
<TABLE>
- Preview the page
- Note the unnecessary white space above the table
I've attached two screen shots to show what this looks like on my system. If you are still unable to duplicate this problem, perhaps it is related to the theme I'm using which is 2012.
Thanks,
Chuck
I couldn't figure out how to attach an image to this so I posted the images here:
https://dl.dropboxusercontent.com/u/15506155/Screen%20Shot%201.jpg
https://dl.dropboxusercontent.com/u/15506155/Screen%20Shot%202.jpg
#3
@
9 years ago
- Component changed from Editor to Formatting
- Keywords needs-patch added; reporter-feedback removed
<TABLE> <TR> <TD>xx</TD><TD>yy</TD></TR> <TR><TD>11</TD><TD>22</TD></TR> <TABLE>
Is not valid HTML, but it will end up like this in the DOM:
<table>
<tbody>
<tr>
<td>xx</td><td>yy</td>
</tr>
<tr>
<td>11</td><td>22</td>
</tr>
</tbody>
</table>
However, WordPress adds the following before that:
<p></p><br><br><br><br> …
If you enter the valid table from the DOM in the editor and save the post, not <br>'s are being printed anymore.
Sounds like a wpautop() to me.
#4
@
8 years ago
Seems to be a classical wpautop case. When inserting structured HTML into a post, linebreaks will be converted to <br> or <p> through wpautop.
There are plugins available to disable wpautop on certain posts: https://de.wordpress.org/plugins/toggle-wpautop/
This will require users to decide whether to:
- disable wpautop when linebreak-formatted HTML is used. If you have a big site, you may insert many <p>-Tags and/or <br /> tags manually for formatting text.
- keep wpautop enabled, but write all HTML in line.
This occurs too with linebreak-formatted div-tags etc.
I don't think this is a bug, as wpautop just does it's job and you should disable it when you work with complex HTML in your Post.
Thanks for the report.
I cannot reproduce the issue by pasting any of the two examples above. Could you please give us the exact steps to reproduce?