الخصائص التي تعمل مثل نظيراتها في CSS:
- height وmaxHeight وminHeight (مثلاً 100px)
- width وmaxWidth وminWidth (مثلاً 100px)
- الحشو والهامش (مثل "4px 4px 4px 4px" أو "4px" فقط)
- color وbackgroundColor (مثل "red" أو #FF0000)
- border (مثل "1px solid black")
- borderColor (مثل "أحمر أسود أزرق #FF0000")
- borderRadius (مثلاً 10px)
- borderStyle (مثلاً، "solid dashed none dotted")
- borderWidth (مثلاً 1px 0px 1px 0px)
- fontSize (مثلاً 24px)
- fontStyle (مثل "مائل")
- fontWeight (مثل "bold" أو "100")
- fontFamily (مثلاً monospace أو serif)
- textAlign (مثل left أو center)
- textDecoration (مثل "underline" أو "line-through")
- whiteSpace (مثلاً nowrap أو pre)
- shown (صحيح أو خطأ)
خصائص التنسيق المخصّص المسموح بها (اطّلِع على مستندات ui.Panel.Layout):
- stretch ('horizontal', 'vertical', 'both')
- position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)
الاستخدام | المرتجعات |
---|---|
Panel.style() | ui.data.ActiveDictionary |
الوسيطة | النوع | التفاصيل |
---|---|---|
هذا: ui.widget | ui.Widget | مثيل ui.Widget |
أمثلة
محرِّر الرموز البرمجية (JavaScript)
// Define a UI widget and add it to the map. var widget = ui.Panel({style: {width: '400px', height: '200px'}}); 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);