'center' tag in phpbb3 :<

Get help developing custom BBCodes or request one.
Rika
Registered User
Posts: 1
Joined: Thu Sep 13, 2018 8:46 pm

'center' tag in phpbb3 :<

Post by Rika »

Why does not the 'center' tag work?

Did not work:

Code: Select all

[center] {TEXT} [/center]

[centre] {TEXT} [/centre]

<center>{TEXT}</center>

<div align="center">{TEXT}</div> 
How to make the 'center' tag work?
User avatar
AlfredoRamos
Recognised Extension Developer
Posts: 1302
Joined: Wed Dec 25, 2013 9:06 pm
Location: /dev/null
Name: Alfredo
Contact:

Re: 'center' tag in phpbb3 :<

Post by AlfredoRamos »

<center> is no longer supported in HTML5.

BBCode template:

Code: Select all

[center]{TEXT}[/center]
HTML replacement:

Code: Select all

<div style="text-align:center">{TEXT}</div>
I'm using the following, it might help you:

BBCode template:

Code: Select all

[align={CHOICE=left,right,center,justify;defaultValue=left}]{TEXT}[/align]
HTML replacement:

Code: Select all

<div style="text-align:{CHOICE}">{TEXT}</div>
Example:

Code: Select all

[align=center]Centered text[/align]
Some of my phpBB extensions:
:chart_with_upwards_trend: SEO Metadata | Image Markdown | :shield: hCaptcha
:trophy: Check out all my validated extensions :trophy:

:penguin: Arch Linux user | Linux Boards :penguin:
hrx
Registered User
Posts: 229
Joined: Wed Nov 18, 2015 11:21 am
Location: PL

Re: 'center' tag in phpbb3 :<

Post by hrx »

This code for centring is correct? The code works correctly in my forum.

Code: Select all

[centre]{TEXT}[/centre]

<span style="display: block; text-align: center;">{TEXT}</span>
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: 'center' tag in phpbb3 :<

Post by Lumpy Burgertushie »

point is that phpbb does not come with a center bbcode at all. you do have to create one yourself. the posts above show you how.

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
hrx
Registered User
Posts: 229
Joined: Wed Nov 18, 2015 11:21 am
Location: PL

Re: 'center' tag in phpbb3 :<

Post by hrx »

I know it. My code has a "span style", this is correct?

Code: Select all

<span style="display: block; text-align: center;">{TEXT}</span>
Whether simply better to use this code?

Code: Select all

<div style="text-align:{CHOICE}">{TEXT}</div>
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6673
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: 'center' tag in phpbb3 :<

Post by HiFiKabin »

This is what I use

Code: Select all

[Center]{TEXT}[/Center]

Code: Select all

<div align="center">{TEXT}</div>
hrx
Registered User
Posts: 229
Joined: Wed Nov 18, 2015 11:21 am
Location: PL

Re: 'center' tag in phpbb3 :<

Post by hrx »

Thanks for the information. ;)
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: 'center' tag in phpbb3 :<

Post by canonknipser »

HiFiKabin wrote: Wed Sep 19, 2018 9:43 am This is what I use

Code: Select all

<div align="center">{TEXT}</div>
You know that's deprecated syntax and not compatible with HTML5? See: https://www.w3schools.com/tags/att_div_align.asp
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
hrx
Registered User
Posts: 229
Joined: Wed Nov 18, 2015 11:21 am
Location: PL

Re: 'center' tag in phpbb3 :<

Post by hrx »

So what is the new syntax compatible with HTML5?
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6673
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: 'center' tag in phpbb3 :<

Post by HiFiKabin »

No I didn't Frank (well, I did but I forgot :oops: ) thanks for reminding me.

Code: Select all

<div style="text-align: center">{TEXT}</div>
Works and is AFAIK HTML5 compliant
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: 'center' tag in phpbb3 :<

Post by Lumpy Burgertushie »

HiFiKabin wrote: Mon Sep 24, 2018 5:23 pm No I didn't Frank (well, I did but I forgot :oops: ) thanks for reminding me.

Code: Select all

<div style="text-align: center">{TEXT}</div>
Works and is AFAIK HTML5 compliant
actually, it should be :

Code: Select all

<div style="text-align: center;">{TEXT}</div>
you missed the semi colon

robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6673
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James
Contact:

Re: 'center' tag in phpbb3 :<

Post by HiFiKabin »

I'd forget my head if it wasn't screwed on :roll:

Thanks Robert
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: 'center' tag in phpbb3 :<

Post by canonknipser »

hrx wrote: Mon Sep 24, 2018 5:09 pm So what is the new syntax compatible with HTML5?
Follow the link:
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
User avatar
warmweer
Jr. Extension Validator
Posts: 11234
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Bel ... gium
Contact:

Re: 'center' tag in phpbb3 :<

Post by warmweer »

Not sure why you're using align instead of float
IIRC you can't use left right and center in 1 line without getting linebreaks.
With float that is possible (I think)
something like:

BBcode Usage : [float=center]{TEXT}[/float]

HTML Replacement : <div style="float:center; padding:0 12px;">{TEXT}</div>

*change padding and px to what fits your style best.


edit at 22:53
: just saw that approximately the same was earlier this week : viewtopic.php?f=438&t=2490751#p15121906
Spelling is freeware, which means you can use it for free.
On the other hand, it is not open source, which means you cannot change it or publish it in a modified form.


Time flies like an arrow, but fruit flies like a banana.
User avatar
Lumpy Burgertushie
Registered User
Posts: 69223
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: 'center' tag in phpbb3 :<

Post by Lumpy Burgertushie »

I haven't checked that but I have never heard of a center attribute for float. just left, right and none.


robert
Premium phpBB 3.3 Styles by PlanetStyles.net

I am pleased to announce that I have completed the first item on my bucket list. I have the bucket.
Post Reply

Return to “Custom BBCode Development and Requests”