A way to access the predefined style values via python

An HTML can just include <style> tags. These get applied to the global scope, so it is encouraged to use class-based selectors for custom things, ideally with a prefix for your content, so as not to destroy the whole UI because of a bad selector, e.g. * {display: none}.

This can be coupled with the DOMWidget.add_class method, so one can even style stock Widgets (or their children), useful for overloading some of the generally sane defaults.

Note, though, that elements built within a raw HTML will not have very much reactivity available to them… there is ipyevents, which can get a bit further.

2 Likes