openharmony 鸿蒙 js-lite-common-styles

2025-06-12 浏览 (1)

Universal Styles

You can set universal styles for components in the style attribute or .css files.

NameTypeDefault ValueMandatoryDescription
width<length> |<percentage>5+-NoComponent width.

If this attribute is not set, the default value 0 is used.
height<length> |<percentage>5+-NoComponent height.

If this attribute is not set, the default value 0 is used.
padding<length>0NoShorthand attribute to set the padding for all sides in a declaration.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).
padding-[left|top|right|bottom]<length>0NoLeft, top, right, and bottom padding.
margin<length> |<percentage>5+0NoShorthand attribute to set the margin for all sides in a declaration. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).
margin-[left|top|right|bottom]<length> |<percentage>5+0NoLeft, top, right, and bottom margins.
border-width<length>0NoShorthand attribute to set the margin for all sides.
border-color<color>blackNoShorthand attribute to set the color for all borders.
border-radius<length>-NoRadius of round-corner borders.
background-color<color>-NoBackground color.
opacity5+number1NoOpacity of an element. The value ranges from 0 to 1. The value 1 means opaque, and 0 means completely transparent.
displaystringflexNoType of the box containing an element. Available values are as follows:
- flex: flexible layout
- none: not rendered
[left|top]<length> |<percentage>6+-NoEdge of the element.
- left: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- top: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.

NOTE

The aforementioned universal styles are not mandatory.

Currently, the following color formats are supported:

  • rgb(255, 255, 255)

  • rgba(255, 255, 255, 1.0)

  • HEX formats: #rrggbb and #aarrggbb

  • Enumeration format: as listed in Table 1. The enumeration format is not supported in the script.

Table 1 Color enums

NameHexadecimal CodeColor
aliceblue#f0f8ffaliceblue
antiquewhite#faebd7antiquewhite
aqua#00ffffaqua
aquamarine#7fffd4aquamarine
azure#f0ffffazure
beige#f5f5dcbeige
bisque#ffe4c4bisque
black#000000000000
blanchedalmond#ffebcdblanchedalmond
blue#0000ffblue
blueviolet#8a2be2blueviolet
brown#a52a2abrown
burlywood#deB887burlywood
cadetblue#5f9ea0cadetblue
chartreuse#7fff00chartreuse
chocolate#d2691echocolate
coral#ff7f50coral
cornflowerblue#6495edcornflowerblue
cornsilk#fff8dccornsilk
crimson#dc143ccrimson
cyan#00ffffcyan
darkblue#00008bdarkblue
darkcyan#008b8bdarkcyan
darkgoldenrod#b8860bdarkgoldenrod
darkgray#a9a9a9darkgray
darkgreen#006400darkgreen
darkgrey#a9a9a9darkgrey
darkkhaki#bdb76bdarkkhaki
darkmagenta#8b008bdarkmagenta
darkolivegreen#556b2fdarkolivegreen
darkorange#ff8c00darkorange
darkorchid#9932ccdarkorchid
darkred#8b0000darkred
darksalmon#e9967adarksalmon
darkseagreen#8fbc8fdarkseagreen
darkslateblue#483d8bdarkslateblue
darkslategray#2f4f4fdarkslategray
darkslategrey#2f4f4fdarkslategrey
darkturquoise#00ced1darkturquoise
darkviolet#9400d3darkviolet
deeppink#ff1493deeppink
deepskyblue#00bfffdeepskyblue
dimgray#696969dimgray
dimgrey#696969dimgrey
dodgerblue#1e90ffdodgerblue
firebrick#b22222firebrick
floralwhite#fffaf0floralwhite
forestgreen#228b22forestgreen
fuchsia#ff00fffuchsia
gainsboro#dcdcdcgainsboro
ghostwhite#f8f8ffghostwhite
gold#ffd700gold
goldenrod#daa520goldenrod
gray#808080gray
green#008000green
greenyellow#adff2fgreenyellow
grey#808080grey
honeydew#f0fff0honeydew
hotpink#ff69b4hotpink
indianred#cd5c5cindianred
indigo#4b0082indigo
ivory#fffff0ivory
khaki#f0e68ckhaki
lavender#e6e6falavender
lavenderblush#fff0f5lavenderblush
lawngreen#7cfc00lawngreen
lemonchiffon#fffacdlemonchiffon
lightblue#add8e6lightblue
lightcoral#f08080lightcoral
lightcyan#e0fffflightcyan
lightgoldenrodyellow#fafad2lightgoldenrodyellow
lightgray#d3d3d3lightgray
lightgreen#90ee90lightgreen
lightpink#ffb6c1lightpink
lightsalmon#ffa07alightsalmon
lightseagreen#20b2aalightseagreen
lightskyblue#87cefalightskyblue
lightslategray#778899lightslategray
lightslategrey#778899lightslategrey
lightsteelblue#b0c4delightsteelblue
lightyellow#ffffe0lightyellow
lime#00ff00lime
limegreen#32cd32limegreen
linen#faf0e6linen
magenta#ff00ffmagenta
maroon#800000maroon
mediumaquamarine#66cdaamediumaquamarine
mediumblue#0000cdmediumblue
mediumorchid#ba55d3mediumorchid
mediumpurple#9370dbmediumpurple
mediumseagreen#3cb371mediumseagreen
mediumslateblue#7b68eemediumslateblue
mediumspringgreen#00fa9amediumspringgreen
mediumturquoise#48d1ccmediumturquoise
mediumvioletred#c71585mediumvioletred
midnightblue#191970midnightblue
mintcream#f5fffamintcream
mistyrose#ffe4e1mistyrose
moccasin#ffe4b5moccasin
navajowhite#ffdeadnavajowhite
navy#000080navy
oldlace#fdf5e6oldlace
olive#808000olive
olivedrab#6b8e23olivedrab
orange#ffa500orange
orangered#ff4500orangered
orchid#da70d6orchid
palegoldenrod#eee8aapalegoldenrod
palegreen#98fb98palegreen
paleturquoise#afeeeepaleturquoise
palevioletred#db7093palevioletred
papayawhip#ffefd5papayawhip
peachpuff#ffdab9peachpuff
peru#cd853fperu
pink#ffc0cbpink
plum#dda0ddplum
powderblue#b0e0e6powderblue
purple#800080purple
rebeccapurple#663399rebeccapurple
red#ff0000red
rosybrown#bc8f8frosybrown
royalblue#4169e1royalblue
saddlebrown#8b4513saddlebrown
salmon#fa8072salmon
sandybrown#f4a460sandybrown
seagreen#2e8b57seagreen
seashell#fff5eeseashell
sienna#a0522dsienna
silver#c0c0c0silver
skyblue#87ceebskyblue
slateblue#6a5acdslateblue
slategray#708090slategray
slategrey#708090slategray
snow#fffafasnow
springgreen#00ff7fspringgreen
steelblue#4682b4steelblue
tan#d2b48ctan
teal#008080teal
thistle#d8Bfd8thistle
tomato#ff6347tomato
turquoise#40e0d0turquoise
violet#ee82eeviolet
wheat#f5deb3wheat
white#ffffffwhite
whitesmoke#f5f5f5whitesmoke
yellow#ffff00yellow
yellowgreen#9acd32yellowgreen

你可能感兴趣的鸿蒙文章

harmony 鸿蒙JavaScript-compatible Web-like Development Paradigm (ArkUI.Lite)

harmony 鸿蒙Universal Attributes

harmony 鸿蒙Universal Events

harmony 鸿蒙chart

harmony 鸿蒙image-animator

harmony 鸿蒙image

harmony 鸿蒙input

harmony 鸿蒙marquee

harmony 鸿蒙picker-view

harmony 鸿蒙progress

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/CZwuTk