Replace font size BBCodes' inline HTML with CSS

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
ecwpa
Registered User
Posts: 181
Joined: Mon Jan 24, 2005 2:10 am
Contact:

Replace font size BBCodes' inline HTML with CSS

Post by ecwpa »

This is how small bbcode looks like:

Code: Select all

[size=85]Small[/size]
Here's the HTML that renders:

Code: Select all

<span style="font-size: 85%; line-height: normal">Small</span>
Same goes for tiny, large and huge font bbcodes.

The problem is they're all just <span> sections hardcoded to the final HTML, I can't style them individualy. If I want the Large bbcode to be a bit bigger that affects all of the others, same happens if I try to use a specific font color for one of them.

I know I could create new bbcodes but that's not the point, we shouldn't have font bbcodes hardcoded to HTML.

So, the proposal is just having 4 CSS classes:

Code: Select all

.small-text    {font-size: 85%; }
.normal-text {font-size: 100%; }
.large-text  {font-size: 150%; }
.huge-text  {font-size: 200%; }
So if I want to add something to it, I can.
Slightly better English than it was in 2005, still improving :D


User avatar
hanakin
Front-End Dev Team Lead
Front-End Dev Team Lead
Posts: 968
Joined: Sat Dec 25, 2010 9:02 pm
Contact:

Re: Replace font size BBCodes' inline HTML with CSS

Post by hanakin »

+1 but expand to any and all inline styles, I believe the lists are handled the same way where it would get difficult is with the colours
Donations welcome via Paypal Image

User avatar
Dragosvr92
Registered User
Posts: 624
Joined: Tue May 31, 2011 12:08 pm
Location: Romania
Contact:

Re: Replace font size BBCodes' inline HTML with CSS

Post by Dragosvr92 »

Its a good idea... Sort of.
Do you want to replace the style="" with class="" and still keep it as span or div?
Your idea is good, but the point of the embedded css in the span is because people need to insert the desired number.
Previous user: TheKiller
Avatar on Memberlist 1.0.3

ecwpa
Registered User
Posts: 181
Joined: Mon Jan 24, 2005 2:10 am
Contact:

Re: Replace font size BBCodes' inline HTML with CSS

Post by ecwpa »

Good point. Now that you mention it that must be the reason it works that way.

Anyway, you can keep the font-size hardcoded with style=, but let us have classes for the rest.
Slightly better English than it was in 2005, still improving :D

User avatar
Dragosvr92
Registered User
Posts: 624
Joined: Tue May 31, 2011 12:08 pm
Location: Romania
Contact:

Re: Replace font size BBCodes' inline HTML with CSS

Post by Dragosvr92 »

I am getting more and more lost in this... :|
Your main request was to get rid of the hardcodded fonts.

To do what you want, they will need to leave the existing size bbcode as it is and add 4 new bbcodes that have that class.
I dont see why .... Because il will make it easyer for you to controll them?

You can control them as they are now also.
Apply this on the html you posted..
span[style="font-test: 85%; line-height: normal"]{color:red;}
Previous user: TheKiller
Avatar on Memberlist 1.0.3

ecwpa
Registered User
Posts: 181
Joined: Mon Jan 24, 2005 2:10 am
Contact:

Re: Replace font size BBCodes' inline HTML with CSS

Post by ecwpa »

Lost why? It's pretty clear, you're getting it right.

I like your solution, thanks. Although, it's still a workaround and the craziest pseudoclass I've ever seen, from the getgo I'm feeling compatility concerns.

So, even if this works, my RFC suggestion stands.
Slightly better English than it was in 2005, still improving :D

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: Replace font size BBCodes' inline HTML with CSS

Post by imkingdavid »

What if someone wants to have text at 125%? This new way would not allow that, since the only options would be 85%, 100%, 150%, and 200%. Also, this would need the font bbcode input to change from number to word (small, huge, etc.).
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Replace font size BBCodes' inline HTML with CSS

Post by MichaelC »

+1
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

ecwpa
Registered User
Posts: 181
Joined: Mon Jan 24, 2005 2:10 am
Contact:

Re: Replace font size BBCodes' inline HTML with CSS

Post by ecwpa »

imkingdavid wrote:What if someone wants to have text at 125%? This new way would not allow that, since the only options would be 85%, 100%, 150%, and 200%. Also, this would need the font bbcode input to change from number to word (small, huge, etc.).
That's the thing. The size part looks like a lot of redundant code via CSS.

I'm not sure how many users use custom sizes but I bet most of them just use the 5 sizes labeled as as tiny, small, normal, big and huge. I'd like to have some control over those 5 only, just adding a class to the inline code would be enough for me and even theme designers.

So, It could look like this:

Code: Select all

<span style="font-size: 85%;" class="small-text">Small</span>

Code: Select all

.small-text  { line-height: normal"; }
Slightly better English than it was in 2005, still improving :D

Post Reply