Properties, die sich wie ihre CSS-Entsprechungen verhalten:
– height, maxHeight, minHeight (z.B. „100px“)
– width, maxWidth, minWidth (z.B. „100px“)
– padding, margin (z.B. „4px 4px 4px 4px“ oder einfach „4px“)
– color, backgroundColor (z.B. „red“ oder „#FF0000“)
– border (z.B. „1px solid black“)
– borderColor (z.B. „red black blue #FF0000“)
– borderRadius (z.B. „10px“)
– borderStyle (z.B. „solid dashed none dotted“)
– borderWidth (z.B. „1px 0px 1px 0px“)
– fontSize (z.B. „24px“)
– fontStyle (z.B. „italic“)
– fontWeight (z.B. „bold“ oder „100“)
– fontFamily (z.B. „monospace“ oder „serif“)
– textAlign (z.B. „left“ oder „center“)
– textDecoration (z.B. „underline“ oder „line-through“)
– whiteSpace (z.B. „nowrap“ oder „pre“)
– shown (true oder false)
Unterstützte benutzerdefinierte Layouteigenschaften (siehe Dokumentation zu ui.Panel.Layout):
– stretch ('horizontal', 'vertical', 'both')
– position („top-right“, „top-center“, „top-left“, „bottom-right“, …)
Nutzung | Ausgabe |
---|---|
Slider.style() | ui.data.ActiveDictionary |
Argument | Typ | Details |
---|---|---|
So gehts: ui.widget | ui.Widget | Die ui.Widget-Instanz. |
Beispiele
Code-Editor (JavaScript)
// Define a UI widget and add it to the map. var widget = ui.Slider({style: {width: '400px'}}); Map.add(widget); // View the UI widget's style properties; an ActiveDictionary. print(widget.style()); // ActiveDictionaries are mutable; set a style property. widget.style().set('backgroundColor', 'E0E0E0'); print(widget.style()); // Define the UI widget's style ActiveDictionary as a variable. var widgetStyle = widget.style(); print(widgetStyle); // Set the UI widget's style properties from the ActiveDictionary variable. widgetStyle.set({border: '5px solid darkgray'}); print(widgetStyle);