Właściwości, które działają tak samo jak ich odpowiedniki w arkuszu CSS:
- height, maxHeight, minHeight (np. '100px')
- width, maxWidth, minWidth (np. „100 px”)
- wypełnienie, margines (np. „4px 4px 4px 4px” lub po prostu „4px”)
- color, backgroundColor (np. „red” lub „#FF0000”)
- obramowanie (np. „1px solid black”)
- borderColor (np. „czerwony czarny niebieski #FF0000”)
- borderRadius (np. „10 px”)
- borderStyle (np. 'solid dashed none dotted')
- borderWidth (np. '1px 0px 1px 0px')
- fontSize (np. '24px')
- fontStyle (np. 'italic')
- fontWeight (np. „bold” lub „100”)
- fontFamily (np. „monospace” lub „serif”)
- textAlign (np. „left” lub „center”)
- textDecoration (np. „underline” lub „line-through”)
- whiteSpace (np. „nowrap” lub „pre”)
- wyświetlany (prawda lub fałsz)
Obsługiwane właściwości niestandardowego układu (patrz dokumentacja ui.Panel.Layout):
- rozciąganie (opcje „horizontal”, „vertical” lub „both”)
- position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
Wykorzystanie | Zwroty |
---|---|
Button.style() | ui.data.ActiveDictionary |
Argument | Typ | Szczegóły |
---|---|---|
to: ui.widget | ui.Widget | instancja ui.Widget. |
Przykłady
Edytor kodu (JavaScript)
// Define a UI widget and add it to the map. var widget = ui.Button({label: 'A ui.Button', 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', 'lightgray'); 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);