For some reason, CKEditor insists that my <a> tags be immediately around plain text, and not a div. This is easily reproduced using the online demo here on this site (http://ckeditor.com/demo)
To reproduce this problem, go to the demo page and click the button to switch to the source view. Delete all the sample html and paste in this simple HTML of an <a> tag surrounding a <div> and some text...
<a href="http://domain.com/"> <div class="text">Click Here</div> </a>
Re: CKEditor won't allow <div> inside <a>
Re: CKEditor won't allow <div> inside <a>
Does anyone with a CDL license read these posts? Would you be willing to let the developers know about this? It's still 100% reproducible with the demo on the product site (http://ckeditor.com/demo).
Re: CKEditor won't allow <div> inside <a>
Thank you, thank you, thank you to Sebastian from CKSource. He researched this and found out that my example is in fact incorrect XHTML 1.1 because inline tags (like my anchor tag in this example) cannot include block-level tags (like the div in this example). That has nothing to do with any CKEditor limitation; it's simply being proper and adhering to the strict definition of XHTML 1.1.
So the proper thing to do is change my div tag to a span tag because span tags are inline elements. So here is valid XHTML that is not altered so drastically:
Re: CKEditor won't allow <div> inside <a>
Thank developer j.swiderski for taking the time to clarify it to me, actually.![;)](http://b.cksource.com/a/2/img/smilies/icon_e_wink.gif)
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Valid HTML5 Code - see bug
Found this post in a search on Google looking for a solution to this valid HTML5 markup. So if you got here by a similar query, see this ticket for more info http://dev.ckeditor.com/ticket/7961
You can actually do this if you don't mind tweaking the DTD
This has worked for my project's purposes:
Obviously, any time you mess with the default DTD you're risking all sorts of subtle bugs, but this has worked well enough for us.
We ended up doing the same
We ended up doing the same thing. We were iffy on making the change wondering what would blow up. :)