Float a DIV left with BBcode?

Get help developing custom BBCodes or request one.
Post Reply
ryecon
Registered User
Posts: 10
Joined: Sat Mar 09, 2019 3:34 pm

Float a DIV left with BBcode?

Post by ryecon » Sun May 19, 2019 2:03 pm

Can you wrap a DIV around content within a post to make that content float left?

HTML example:

Code: Select all

<div style="float:left">div2</div>

<p>some text</p>
Output:

div2sometext


I tried in BBcode to do:

Code: Select all

[left]{text}[/left]

Code: Select all

<div style="float:left">{text}</div>

The content I am trying to float left is a lightbox thumbnail, but it could be any text or image. The above code when wrapped around text or image just displays the tags, does not float left. All I get is:

[left]testtest[/left]

Am I doing something wrong or is this just not possible?

User avatar
Raul [ThE KuKa]
Style Customisations
Style Customisations
Posts: 6014
Joined: Mon Dec 08, 2003 9:24 pm
Location: Spain
Name: Raul Arroyo
Contact:

Re: Float a DIV left with BBcode?

Post by Raul [ThE KuKa] » Mon May 20, 2019 6:20 pm

Read this, may it serve you in part, or to have ideas:
viewtopic.php?p=15121906#p15121906
All unsolicited PMs will be ignored.
:warning: Knowledge Base | Documentation | Board rules | phpBB Styles Rules & Policies :warning:


If you like my styles, translations, etc. and want to show some appreciation, then feel free to Donate with Image
:flag_es: phpBB Spain - Online Since 2003 :heart:



User avatar
Tastenplayer
Registered User
Posts: 249
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: Float a DIV left with BBcode?

Post by Tastenplayer » Mon May 20, 2019 7:44 pm

Code: Select all

[float={IDENTIFIER}]{TEXT}[/float]

Code: Select all

<div style="float:{IDENTIFIER}; padding:0 10px;">{TEXT}</div>

Code: Select all

[float=left/right/center]Text oder Bild[/float]
https://www.phpbb.com/customise/db/bbco ... ext_image/ (Maybe this code still works in 3.2.x.)
My phpBB Style Board & MoreBROWSERLING - Test your style live in all IE Versions
Released Ahoi & Ahoi_junior
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school. The best online Translator

ryecon
Registered User
Posts: 10
Joined: Sat Mar 09, 2019 3:34 pm

Re: Float a DIV left with BBcode?

Post by ryecon » Tue May 21, 2019 8:19 pm

Thanks for the replies!
Tastenplayer wrote:
Mon May 20, 2019 7:44 pm

Code: Select all

[float={IDENTIFIER}]{TEXT}[/float]
What is 'identifier'? Searched but cannot find info on it.

Tested the code posted but it does not work. It is basically the same code I tried in my OP. It does not format the {text} it just displays as:

[float]text[/float]

Any way I try to float a div left it displays as above,

I have BBcode working to float an image left, it does as expected:

Code: Select all

[pic_small_left]{URL}[/pic_small_left]

Code: Select all

<img src="{URL}" style="float:left;padding-right: 5px;max-height: 100px; width:auto;" />
So the IMAGE element can be floated and text will wrap as expected. But DIV element does not seem to want to work.

1- Is there a formatting error or typo in my original code?

2- Why are the tags being displayed in the post?

ryecon
Registered User
Posts: 10
Joined: Sat Mar 09, 2019 3:34 pm

Re: Float a DIV left with BBcode?

Post by ryecon » Tue May 21, 2019 11:46 pm

Well I got it working. Not sure what was wrong with previous code as this code is basically the same. Maybe BBcode did not like what I tried to name the tag or maybe there was blank space issue I did not see... no idea.

Anyway, this works in 3.2.5:

Code: Select all

[float_left]{TEXT}[/float_left]

Code: Select all

<div style="float:left; padding:0 10px;">{TEXT}</div>

Code: Select all

Float left for text wrap: img, video, text
Use [float_left]anything[/float_left] tags around anything to float it left and allow text (or anything else) to wrap or be positioned beside it.

I am using it to position multiple lines of text beside a lightbox thumbnail.

Thanks.

User avatar
Tastenplayer
Registered User
Posts: 249
Joined: Thu Jul 03, 2014 9:20 pm
Location: Switzerland
Name: Jutta Koliofotis
Contact:

Re: Float a DIV left with BBcode?

Post by Tastenplayer » Thu May 23, 2019 9:52 am

ryecon wrote:
Tue May 21, 2019 11:46 pm
Anyway, this works in 3.2.5:

Code: Select all

[float_left]{TEXT}[/float_left]

Code: Select all

<div style="float:left; padding:0 10px;">{TEXT}</div>

Code: Select all

Float left for text wrap: img, video, text
Also works in 3.2.7 with an attachement image and text to the right of it.
My phpBB Style Board & MoreBROWSERLING - Test your style live in all IE Versions
Released Ahoi & Ahoi_junior
Be the best version of yourself rather than a bad copy of someone else!
Excuse me for my English, but I learned the language by speaking to people and not at school. The best online Translator

Post Reply

Return to “Custom BBCode Development and Requests”