Collapse-O-Matic > Swap Title

In the following example we have a trigger that toggles the text between expanded and close states.

[expand title="Läs mer" swaptitle="Visa mindre"]the target content[/expand]
Läs mer
the target content
Läs mer
the target content

Wait, what? Why is the trigger moving all the way over to the left? Let’s try changing the trigger tag to a div rather than a span using the tag attribute:

[expand title="Läs mer" swaptitle="Visa mindre" tag="div"]the target content[/expand]
Läs mer
the target content

Better, but now why is there so much space under the trigger? What if we wrap the entire shortcode in a div using the elwraptag attribute?

[expand title="Läs mer" swaptitle="Visa mindre" tag="div" elwraptag="div"]the target content[/expand]
Läs mer
the target content

Okay… that worked as it should. does it also work using the standard span tag as well?

[expand title="Läs mer" swaptitle="Visa mindre" elwraptag="div"]the target content[/expand]
Läs mer
the target content

Yes it does. It seems that this theme, or this version of WordPress or the WordPress Block editor is processing the shortcode differently. More testing is needed on this. Here is an example using the WordPress classic editor.

Span

Läs mer
the target content

Div

Läs mer
the target content

Elwraptag & Span

Läs mer
the target content

Elwraptag & Div

Läs mer
the target content