CarisMu commited on
Commit
f754e2b
1 Parent(s): 35a3f42

Make table responsive

Browse files
Files changed (1) hide show
  1. main.py +11 -10
main.py CHANGED
@@ -841,17 +841,16 @@ styled_table = (
841
  ],
842
  axis=0,
843
  )
844
- .set_properties(**{"text-align": "center"}) # Center the text in all cells
 
 
 
 
 
 
845
  .set_table_styles(
846
  [
847
- {
848
- "selector": "table",
849
- "props": [
850
- ("margin-left", "20%"),
851
- ("margin-right", "auto"),
852
- ("width", "100%"),
853
- ],
854
- }, # Center the table and adjust width
855
  ]
856
  )
857
  .hide(axis="index") # Hide the row index
@@ -860,7 +859,9 @@ styled_table = (
860
  table_html_data = styled_table._repr_html_()
861
  # table_html_data = dataset_sources.to_html(index=False, border=0)
862
  table_div_data = Div(
863
- NotStr(table_html_data), style="margin-left: auto; width: 80%; align: center;"
 
 
864
  )
865
 
866
 
 
841
  ],
842
  axis=0,
843
  )
844
+ .set_properties(
845
+ **{
846
+ "text-align": "center", # Center the text
847
+ "padding": "10px", # Add padding for better readability
848
+ "word-wrap": "break-word", # Ensure text wraps within cells
849
+ }
850
+ )
851
  .set_table_styles(
852
  [
853
+ {"selector": "table", "props": [("margin-left", "auto"), ("margin-right", "auto"), ("width", "100%")]}, # Make table responsive and centered
 
 
 
 
 
 
 
854
  ]
855
  )
856
  .hide(axis="index") # Hide the row index
 
859
  table_html_data = styled_table._repr_html_()
860
  # table_html_data = dataset_sources.to_html(index=False, border=0)
861
  table_div_data = Div(
862
+ # NotStr(table_html_data), style="margin-left: auto; width: 80%; align: center;"
863
+ NotStr(table_html_data)
864
+
865
  )
866
 
867