• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 [Solved] Left, Right & Center Align on the Same Line?

#1
I have been Googling for a while now, both searching the internet and on the forums, it's also been bugging me for years actually but have never found or I suppose searched hard enough for a solution lol.. If this has already been asked and/or answered please for the love of god post a link for me please!

So anyways what I am looking for,

Whenever you post text and use the alignment BBCodes they always end up on a separate lines, what I want is to for example use [LEFT.], [CENTER.] and/or [RIGHT.] and have the text all be on the same line.. I haven't tried much and I suppose I could play around with some custom BBCodes some more but atm I'm worn out and out of ideas..

Code:
[left]LEFT[/left] [center]CENTER[/center] [right]RIGHT[/right]
LEFT​
CENTER​
RIGHT​

Any suggestions or solutions would be greatly appreciated, thank you.
 

katsulynx

Well-known member
#2
Simply spoken: there is no solution. While it might be possible to have some left- and right-aligned text in one line in general, it's quite messy when it comes to getting that stuff into scaling (both in terms of page width and text length), but the most important thing is, that it's not possible to do it for centered text. The thing is with centered text, that it's essentially placed in the middle, of its containing element. So in order to be in the "correct" middle, the element needs to either span the whole width, or miss the same portion left and right respectively. There surely would be some solutions, most of them likely containing javascript - if not all - and I personally don't think they'd be worth the effort.
 

tajhay

Well-known member
#3
Tried doing that using the tables bbcode? 3 columns, first one left just, second centred etc.

Or using a parsehtml bbcode.
 
#5
Simply spoken: there is no solution. While it might be possible to have some left- and right-aligned text in one line in general, it's quite messy when it comes to getting that stuff into scaling (both in terms of page width and text length), but the most important thing is, that it's not possible to do it for centered text. The thing is with centered text, that it's essentially placed in the middle, of its containing element. So in order to be in the "correct" middle, the element needs to either span the whole width, or miss the same portion left and right respectively. There surely would be some solutions, most of them likely containing javascript - if not all - and I personally don't think they'd be worth the effort.
Ahh makes sense, also thank you for the detailed response :)

Tried doing that using the tables bbcode? 3 columns, first one left just, second centred etc.

Or using a parsehtml bbcode.
And I sorta thought about using a Table BBCode as well I just haven't went and found a nice one to use yet.. Preferably I would want one that would allow me to customize the table itself so I can make the table invisible without having to change the css and make it invisible everywhere..

Also yes I tried using Parse HTML and am still sorta experimenting with that, the code I used in SMF that worked perfectly no longer works in XenForo so I am trying to figure out what to use to get it to work the way I want it to..

@katsulynx
This is a line of the post I used and it works perfect in SMF but it doesn't work in XenForo so I have been trying some alterations to try and get it to work:
Code:
[html]<div class="floatleft"><strong>Left</strong></div>[/html][html]<div class="floatright">Right</div><div style="clear: both;"></div>[/html]
So for example, using parsehtml, you "would" just change "HTML" to "PARSEHTML".. for some things it still works fine but the float code doesn't work in XenForo :(
 

katsulynx

Well-known member
#6
Ah, I thought using parsehtml would allow you to pack a left & center in one line, cause center is mostly a problem here.
You don't necessarily have to use parsehtml for the above though, you can just create your own bbcodes in the ACP
 
#7
Ah, I thought using parsehtml would allow you to pack a left & center in one line, cause center is mostly a problem here.
You don't necessarily have to use parsehtml for the above though, you can just create your own bbcodes in the ACP
Honestly that was just an example, I don't really ever use center for anything mostly just left & right lol..

Also I did try a while back to create some but they didn't seem to work the way I wanted them to.. but I will try again :)
 
#8
**UPDATE**

Hmm after all these years of fiddling with it on and off I think I finally got it lol, it never occurred to me to just go and see what SMF had in the CSS file that made it work.. So I just grabbed what SMF was using and added it to my EXTRA.css in XenForo and voila, it's working exactly how I wanted it to now.. :cautious:

It's pretty similar to the way the cta float bbcode works, but I think it's because of the way I have it written that works for me, of course this means it won't "really" work anywhere outside my forum unless they use it how I wrote the first line which also means you'd have to have some form of parsing the html or again have the Parse HTML resource installed as well.. so it's not really something I could release unless I find another way to write it so it works without having other resources installed..

might experiment a bit further and find a way around the issues above so I can release something everyone can use.. but whatever, at least it works the way I want now lol..