Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Michael Deroche
7
Views
3
Comments
Preventing placeholder from wrapping content
Question
I have a web block that uses a placeholder. In the browser, the placeholder is compiling to a <div> tag and wrapping its contents.
For example, if I have an image in the placeholder, the generated HTML becomes (shortened for brevity):
<div>
<img />
</div>
Instead of just:
<img />
Which is what I'm looking for.
Is there any way to prevent the placeholder from wrapping its contents in a tag?
It is causing issues with my stylesheets since the order of elements is important. This rogue <div> between a parent element and a child element is breaking the styles.
I tried to set "
OSTagName
" to an empty value, but that just results in the literal string being printed onto the page:
< id="wt121:wtItems:wt274:wtContent">
It got rid of the tag, but still tried to write it to the HTML file. Since there's no tag, the browser treats it as text.
Any help is greatly appreciated.
(I can already feel the "just rewrite your styles" posts--that is not a good option)
João Rosado
Staff
Does that div have an Id or class?Or is it just unnamed?
I ask this because the platform tries to avoid generating unnecessary div/spans unless they are necessary. Not sure if placeholders always generates divs. I think it may always be needed to distinguish different placeholders on the same page with the same web block inside.
Regards,
João Rosado
Guilherme Pereira
Staff
Hi Michael,
When you use a placeholder the platform will always generate a div around your content. One way to remove it would be if you name that placeholder and the use some javascript to remove it while keeping that content.
But because it is a div wouldn't be easier to just adjust your css? Can you shed some light on what rules are breaking when you have that div?
Cheers,
Guilherme
Michael Deroche
Thanks for confirming that this is always the case.
I'm using Bootstrap, so changing the CSS inside of that would require me to repeat that action every time I upgraded it. I would rather future-proof it and mimic the HTML that Bootstrap expects rather than hack at it to accept different HTML.
For now I'm using a hack that will remove the containing <div> with JavaScript.
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...