☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Custom CSS for Div Widget

Community Support
Laura_Suttle
Laura_Suttle

Hello,

I’m trying to use the custom_css property introduced here: Add support for specifying CSS classes on all LayoutDOM by bryevdv · Pull Request #5503 · bokeh/bokeh · GitHub. I have Bokeh 12.5.

I tried to follow this example from here: http://stackoverflow.com/questions/40981485/is-there-a-way-to-format-the-widgets-contents

No matter what I do, the CSS doesn’t seem to affect the table I’m creating for my div widget. The formatting stays the same.

My exact code is:

#div

jtext = “”"

{% for key,value in df.iterrows() %}

{% endfor %}

{{value['Rec_Number']}}: {{value['Recommendation']}}

“”"

t = Template(jtext)

html = t.render(df=output)

recDiv = Div(text=html)

recDiv.css_classes = [“rectable”]

I suspect I am not putting the css in the right place. I am putting it in my general css file for the page. Where exactly does the css go?

Any other help is appreciated. This feature isn’t documented very well, understandably since it is new.

Before anyone asks, I did try the data table widget but I don’t like how it presents the table (forcing each column to have the same size).

⌁   Link to post
Mateusz_Paprocki3
Mateusz_Paprocki3

Hi,

···

On Sun, Apr 9, 2017 at 1:59 AM, Laura Suttle laura.suttle@gmail.com wrote:

Hello,

I’m trying to use the custom_css property introduced here: https://github.com/bokeh/bokeh/pull/5503. I have Bokeh 12.5.

I tried to follow this example from here: http://stackoverflow.com/questions/40981485/is-there-a-way-to-format-the-widgets-contents

No matter what I do, the CSS doesn’t seem to affect the table I’m creating for my div widget. The formatting stays the same.

My exact code is:

#div

jtext = “”"

{% for key,value in df.iterrows() %}

{% endfor %}

{{value['Rec_Number']}}: {{value['Recommendation']}}

“”"

t = Template(jtext)

html = t.render(df=output)

recDiv = Div(text=html)

recDiv.css_classes = [“rectable”]

I suspect I am not putting the css in the right place. I am putting it in my general css file for the page. Where exactly does the css go?

Any other help is appreciated. This feature isn’t documented very well, understandably since it is new.

Before anyone asks, I did try the data table widget but I don’t like how it presents the table (forcing each column to have the same size).

this is a bug. Inheritance chain is broken for render() method in WidgetView and implementation of css_class in LayoutDOMView is never called. This affects all widgets.

Can you submit a bug report at github.com/bokeh/bokeh/issues?

Mateusz

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.

To post to this group, send email to bokeh@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/b434069a-a1d2-474b-8bdf-6f13993d8d3c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post
Laura_Suttle
Laura_Suttle

Thank you for the confirmation that it’s a bug and not user error like I expected. I can submit a bug report tonight.

···

On Monday, April 10, 2017 at 10:19:01 AM UTC-4, mateusz.paprocki wrote:

Hi,

On Sun, Apr 9, 2017 at 1:59 AM, Laura Suttle laura....@gmail.com wrote:

Hello,

I’m trying to use the custom_css property introduced here: https://github.com/bokeh/bokeh/pull/5503. I have Bokeh 12.5.

I tried to follow this example from here: http://stackoverflow.com/questions/40981485/is-there-a-way-to-format-the-widgets-contents

No matter what I do, the CSS doesn’t seem to affect the table I’m creating for my div widget. The formatting stays the same.

My exact code is:

#div

jtext = “”"

{% for key,value in df.iterrows() %}

{% endfor %}

{{value['Rec_Number']}}: {{value['Recommendation']}}

“”"

t = Template(jtext)

html = t.render(df=output)

recDiv = Div(text=html)

recDiv.css_classes = [“rectable”]

I suspect I am not putting the css in the right place. I am putting it in my general css file for the page. Where exactly does the css go?

Any other help is appreciated. This feature isn’t documented very well, understandably since it is new.

Before anyone asks, I did try the data table widget but I don’t like how it presents the table (forcing each column to have the same size).

this is a bug. Inheritance chain is broken for render() method in WidgetView and implementation of css_class in LayoutDOMView is never called. This affects all widgets.

Can you submit a bug report at github.com/bokeh/bokeh/issues?

Mateusz

–

You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/b434069a-a1d2-474b-8bdf-6f13993d8d3c%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled