พร็อพเพอร์ตี้ที่มีลักษณะการทำงานเหมือนกับพร็อพเพอร์ตี้ CSS ที่เกี่ยวข้อง
- height, maxHeight, minHeight (เช่น "100px")
- width, maxWidth, minWidth (เช่น "100px")
- padding, margin (เช่น "4px 4px 4px 4px" หรือ "4px")
- color, backgroundColor (เช่น 'red' หรือ '#FF0000')
- border (เช่น '1px solid black')
- borderColor (เช่น 'red black blue #FF0000')
- borderRadius (เช่น '10px')
- borderStyle (เช่น "solid dashed none dotted")
- borderWidth (เช่น "1px 0px 1px 0px")
- fontSize (เช่น '24px')
- fontStyle (เช่น "italic")
- fontWeight (เช่น "bold" หรือ "100")
- fontFamily (เช่น "monospace" หรือ "serif")
- textAlign (เช่น "left" หรือ "center")
- textDecoration (เช่น "underline" หรือ "line-through")
- whiteSpace (เช่น "nowrap" หรือ "pre")
- แสดง (จริงหรือเท็จ)
พร็อพเพอร์ตี้เลย์เอาต์ที่กำหนดเองที่รองรับ (ดูเอกสารประกอบ ui.Panel.Layout)
- stretch ('horizontal', 'vertical', 'both')
- position ("top-right", "top-center", "top-left", "bottom-right", ...)
การใช้งาน | การคืนสินค้า |
---|---|
Slider.style() | ui.data.ActiveDictionary |
อาร์กิวเมนต์ | ประเภท | รายละเอียด |
---|---|---|
ดังนี้ ui.widget | ui.Widget | อินสแตนซ์ ui.Widget |
ตัวอย่าง
โปรแกรมแก้ไขโค้ด (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);