Ideally something more elegant than an iframe. I've looked around a bit, but I'm not finding much in the way of other people's solutions.
What's wrong with an iFrame? I have went down that path with my latest product. It greatly reduces any conflicts and modifications from client side as it's all managed on your side. It's a combination of VueJS and outputting on their page as an iFrame! Big companies lift Intercom and Drift use a combination of iFrames too.
What kind of widget are you making?
It would depend on the widget but as Shawn & Daniel say, Javascript might be a good way to do it depending on what you need the widget to do (if it needs to load multiple pages then an iframe would be better).
Yup, javascript. Minify it, uglify it, and put it on a CDN for delivery.
You can use javascript and a div then just have your javascript generate and write the html into the div.
What about preventing the site's css from clashing with your own?
Inline and don't use anything that Cascades or prefix your classnames with a random string.