Fixed Xenforo Align [left] [center] [right] bbcodes with new bbcodes

cclaerhout

Well-known member
I know it's not a bug, but it's really annoying. Before (with vB) the align bbcodes were using these commands:
HTML:
<div align="left">my code</div>
HTML:
<div align="center">my code</div>
HTML:
<div align="right">my code</div>

Now it's using the text-align css command
HTML:
<div style="text-align:left">my code</div>
HTML:
<div style="text-align:center">my code</div>
HTML:
<div style="text-align:right">my code</div>

The problem?
It's working with text, even images, but if you created a bbcode using for example that very simple code:
HTML:
<div style="text-align:center; width:150px">
<img src="link_to_image" style="width:150px" /><br />
<span>Image Caption</span>
</div>

Then, the caption and image will be align center inside the div container of 150 pixels, but if this div container is wrapped inside the XenForo [ center ] bbcode, it won't be center inside the post as it used to be with a center bbcode using html "align=center".
 
I think in this particular case, the HTML align attribute gives results that are more predictable for end users than the CSS 'equivalents', so I'll change it in the core.
 
I think in this particular case, the HTML align attribute gives results that are more predictable for end users than the CSS 'equivalents', so I'll change it in the core.
Did you mean that you are implementing a closer CSS 'equivalent' in core? Because my understanding is that the align attribute itself is no longer supported in HTML5.
 
The post is over 2 years old. Certainly the current align BB Codes don't use the align attribute, so there's nothing to worry about there.

Curiously, though, the current align solution is the same that was reported as a bug originally so either another solution was found or the original solution was re-implemented based on the deprecation of that in HTML5.
 
Curiously, though, the current align solution is the same that was reported as a bug originally so either another solution was found or the original solution was re-implemented based on the deprecation of that in HTML5.
Every Bb Codes that are using a block container should implement itself in its options some alignment options and not use the default paragraph alignment. That's a difference with previous scripts developed on vBulletin but that's the easiest and cleanest solution.
 
Last edited:
Top Bottom