0

I have issue on my RTE[Rich Text Editor], I'm using Sharepoint 2013, we have issue on putting custom script inside

element.

Here is the sample code when you put the code in the editor

 <p>Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor<div clas="image_carousel">sample image carousel here</div> Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum sdolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor</p>

but the issue is something like this when you save it:

<p>Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor Lorem ipsum dolor</p>
<div class="image_carousel">sample image carousel here</div>

I already know that its not html standards, but is there any hacks that div will work inside p and will not break. Any suggestions or tips will be helpful. Thanks!

frogcoder
  • 354
  • 5
  • 19

1 Answers1

3

This question has been already answered here.

It is not permitted to put block elements inside a p-tag. However, in practice, this is not actually entirely true. The actual display value is in fact entirely irrelevant; the only thing that is considered is what the default display value is for the tag, e.g. "block" for divs and "inline" for spans. Changing the display value will still make the browser prematurely close the p-tag.

You can style a span-tag to behave exactly like a div-tag, but it will still be accepted inside the p environment.

So instead of doing this:

<p>
  <div>test</div>
</p>

You can do this:

<p>
  <span style="display:block">test</span>
</p>
Community
  • 1
  • 1
Midhun Darvin
  • 1,236
  • 14
  • 24