Page 1 of 1

Highlight Text BBcode

Posted: Fri Jan 05, 2018 9:04 am
by steven
Here is BBcode to highlight text with a little padding. Spaces at the beginning and/or ending of a highlight selection are removed when parsed by phpBB but spaces between characters or words are not removed. In the HTML replacement line below there is no top or bottom padding but 1px of right and left padding. You can change the amount of padding, remove the padding code completely or change the padding number to zero.

BBCode usage:

Code: Select all

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

Code: Select all

<span style="display: inline-block; background-color:yellow; padding:0px 1px;">{TEXT}</span>
Help line:

Code: Select all

Highlight selected text [Ht]TEXT[/Ht]


This is an example of spaces removed and spaces not removed in a sentence. (Sentence format is shown below in the code box)

Code: Select all

This is an example[Ht] of spaces removed [/Ht]and [Ht]spaces not removed[/Ht] in a sentence.
If you want to use different colors, use the code below instead.

BBCode usage:

Code: Select all

[Htc={COLOR}]{TEXT}[/Htc]
HTML replacement:

Code: Select all

<span style="display: inline-block; background-color:{COLOR}; padding:0px 1px;">{TEXT}</span>
Help line:

Code: Select all

Highlight selected text [Htc=color]TEXT[/Htc]
A sentence with pink highlight.