0

We wrote below code in RTE "HTML editor". Saved it. published it.

<div class="content-center">
    <a href="https://google.com">
        <div class="button">apply</div>
    </a>
</div>

Then opened "Show Editor" and added few text to existing tags. saved and published the item. While opening the "HTML Editor" again, the code has been modified like below.

<div class="content-center">
<a href="https://google.com">
</a>
<div class="button">
<a href="https://google.com">apply</a>
</div>*

What should we do to overcome this issue. Any suggestions will be appreciated. Thanks.

1 Answer 1

0

I believe the problem is caused by the fact that according to XHTML standard you can't put <div> inside <a>.

According to Html5 standard, block level elements like <div> are allowed in <a> tags.

But most probably RTE still works based on older standards.

Solution? Maybe replace <div> element with <span class="div"> and use span.div { display: block; } styling?

2
  • Thanks so much. I will try and get back to you.
    – S. Ray
    Sep 18, 2020 at 12:13
  • adding <span> removes the text completely. Any other solution do you have. added this-- <div class="content-center"> <a href="google.com"> <span class="button">apply</span> </a> </div> resulted -- <div class="content-center"> <a href="google.com"> </a></div>
    – S. Ray
    Sep 18, 2020 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.