Properties, die sich wie ihre CSS-Entsprechungen verhalten:
– height, maxHeight, minHeight (z.B. „100 px“)
– width, maxWidth, minWidth (z.B. „100px“)
– padding, margin (z.B. „4px 4px 4px 4px“ oder einfach „4px“)
– color, backgroundColor (z.B. „rot“ oder „#FF0000“)
– border (z.B. „1px solid black“)
– borderColor (z.B. „rot schwarz blau #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“)
– „angezeigt“ (wahr oder falsch)
Unterstützte benutzerdefinierte Layouteigenschaften (siehe Dokumentation zu ui.Panel.Layout):
– „stretch“ (horizontal, vertikal, beides)
– position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
Nutzung | Ausgabe |
---|---|
Checkbox.style() | ui.data.ActiveDictionary |
Argument | Typ | Details |
---|---|---|
das: 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.Checkbox({label: 'A ui.Checkbox', 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('color', 'blue'); 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);