View Full Version : Table Trouble: White space above table
nerbert
12-03-2009, 03:31 AM
White Space Above Table
I've recently made some bb code tags to create tables. I'll go into the details later (in the next two posts), but for now I have a question. The bb code works for the most part but if you type the tags in as below you get a white space above the table:
[table%="100%"]
AAAAAA
AAAAAA
AAAAAA[/td%]
[td]BBBBBB
BBBBBB
BBBBBB
[/table%]
Here's the source code created by the bb code:
<div><table width=100%><br />
<tr><br />
<td width=15% valign = "top">AAAAAA<br />
AAAAAA<br />
AAAAAA</td><br />
<td valign="top">BBBBBB<br />
BBBBBB<br />
BBBBBB</td><br />
</tr><br />
</table></div>
Notice all the line breaks caused by stacking the tags and content. Except for the ones inside the cell text, they don't do anything inside the table but instead are puked up above the table creating the white space.
Alternatively if you type in the code as follows you don't get the line breaks and the table comes out as planned:
[table%="100%"]AAAAAA
AAAAAA
AAAAAA[/td%][td]BBBBBB
BBBBBB
BBBBBB[/table%]
So this is my question: How do I get rid of all the line breaks so I don't get the white space?
Lynne
12-03-2009, 03:34 AM
There is actually another thread about this exact issue. I don't remember what the solution was, but you may want to do a search for it.
nerbert
12-03-2009, 03:35 AM
BB Code For Tables
Here's how I made the bb code in the BB Code Manager:
[table%] = <div><table width={option}>{param}</table></div>
[tr] = <tr>{param}</tr>
[td%] = <td width={option} valign = "top">{param}</td>
[td] = <td valign = "top">{param}</td>
Be sure to set "Use {option}" to yes where appropriate and "Disable BB Code Within This BB Code" to no.
These tags work fine (except as noted in my previous post) so long as you use them properly. But as one of my forum members was quick to demonstrate, you can make a mess of thread layout if you don't close all the tags. I solved the problem with a template modification, which I'll describe in my next post.
--------------- Added 1259818896 at 1259818896 ---------------
Template Modification
To solve problems caused by improper use of my table tags I created a cordon sanitaire to prevent the html from the bb code from messing up the thread layout. All it is is a table around the message area. Any unclosed table tags within a table cell are not executed.
To create the cordon sanitaire go to the postbit template and scroll down about 40% to find this:
<!-- message -->
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]
</div>
<!-- / message -->
Place the following modifications above and below as follows:
<table cellpadding = "0" width ="100%">
<tr>
<if condition="$show['moderated']">
<td class="alt2" width="100%" id="td_post_$post[postid]">
<else />
<td class="alt1" width="100%" id="td_post_$post[postid]">
</if>
<!-- message -->
<div id="post_message_$post[postid]">
$ad_location[ad_showthread_firstpost_start]
$post[message]
</div>
<!-- / message -->
</td></tr>
<tr>
<if condition="$show['moderated']">
<td class="alt2" width="100%" id="td_post_$post[postid]">
<else />
<td class="alt1" width="100%" id="td_post_$post[postid]">
</if>
Now scroll about 90% down and modify as follows:
<!-- / controls -->
</div>
</td></tr></table>
<!-- message, attachments, sig -->
</td>
</tr>
</table>
$template_hook[postbit_end]
--------------- Added 1259819120 at 1259819120 ---------------
There is actually another thread about this exact issue. I don't remember what the solution was, but you may want to do a search for it.
Oops, my bad! I'll have a look. Thanks.
--------------- Added 1259896866 at 1259896866 ---------------
I think this is the thread you were referring to: https://vborg.vbsupport.ru/showthread.php?t=223462&highlight=table.
It doesn't actually offer a solution but directs to BB Code [table] (https://vborg.vbsupport.ru/showthread.php?t=107985&highlight=table+code), which isn't quite what I want.
Still looking for help!
webmastersun
09-05-2014, 02:24 PM
.....................
It doesn't actually offer a solution but directs to BB Code [table] (https://vborg.vbsupport.ru/showthread.php?t=107985&highlight=table+code), which isn't quite what I want.
Still looking for help!
Hey, today I research solution for this problem but not success and I tried BB code table existed in VB editor, it's great !!!
I applied to "advertise with us (http://www.webmastersun.com/threads/776-Advertise-With-Us)" page and it's give me what I want.
I sure more people searching for this problem
Solution is using BBCODE table :)
If allow HTML code in vb usergroup and forum manager, when insert a html table, we will have big space on top of table (reason vbulletin inserted more <br> tag on table automatically) and this didn't have a solution for it
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.