harmony 鸿蒙Universal Styles

  • 2023-06-24
  • 浏览 (439)

Universal Styles

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

Name Type Default Value Mandatory Description
width <length> |<percentage>5+ - No Component width.

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

If this attribute is not set, the default value 0 is used.
padding <length> 0 No Shorthand 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> 0 No Left, top, right, and bottom padding.
margin <length> |<percentage>5+ 0 No Shorthand 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+ 0 No Left, top, right, and bottom margins.
border-width <length> 0 No Shorthand attribute to set the margin for all sides.
border-color <color> black No Shorthand attribute to set the color for all borders.
border-radius <length> - No Radius of round-corner borders.
background-color <color> - No Background color.
opacity5+ number 1 No Opacity of an element. The value ranges from 0 to 1. The value 1 means opaque, and 0 means completely transparent.
display string flex No Type of the box containing an element. Available values are as follows:
- flex: flexible layout
- none: not rendered
[left|top] <length> |<percentage>6+ - No Edge 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

Name Hexadecimal Code Color
aliceblue #f0f8ff aliceblue
antiquewhite #faebd7 antiquewhite
aqua #00ffff aqua
aquamarine #7fffd4 aquamarine
azure #f0ffff azure
beige #f5f5dc beige
bisque #ffe4c4 bisque
black #000000 000000
blanchedalmond #ffebcd blanchedalmond
blue #0000ff blue
blueviolet #8a2be2 blueviolet
brown #a52a2a brown
burlywood #deB887 burlywood
cadetblue #5f9ea0 cadetblue
chartreuse #7fff00 chartreuse
chocolate #d2691e chocolate
coral #ff7f50 coral
cornflowerblue #6495ed cornflowerblue
cornsilk #fff8dc cornsilk
crimson #dc143c crimson
cyan #00ffff cyan
darkblue #00008b darkblue
darkcyan #008b8b darkcyan
darkgoldenrod #b8860b darkgoldenrod
darkgray #a9a9a9 darkgray
darkgreen #006400 darkgreen
darkgrey #a9a9a9 darkgrey
darkkhaki #bdb76b darkkhaki
darkmagenta #8b008b darkmagenta
darkolivegreen #556b2f darkolivegreen
darkorange #ff8c00 darkorange
darkorchid #9932cc darkorchid
darkred #8b0000 darkred
darksalmon #e9967a darksalmon
darkseagreen #8fbc8f darkseagreen
darkslateblue #483d8b darkslateblue
darkslategray #2f4f4f darkslategray
darkslategrey #2f4f4f darkslategrey
darkturquoise #00ced1 darkturquoise
darkviolet #9400d3 darkviolet
deeppink #ff1493 deeppink
deepskyblue #00bfff deepskyblue
dimgray #696969 dimgray
dimgrey #696969 dimgrey
dodgerblue #1e90ff dodgerblue
firebrick #b22222 firebrick
floralwhite #fffaf0 floralwhite
forestgreen #228b22 forestgreen
fuchsia #ff00ff fuchsia
gainsboro #dcdcdc gainsboro
ghostwhite #f8f8ff ghostwhite
gold #ffd700 gold
goldenrod #daa520 goldenrod
gray #808080 gray
green #008000 green
greenyellow #adff2f greenyellow
grey #808080 grey
honeydew #f0fff0 honeydew
hotpink #ff69b4 hotpink
indianred #cd5c5c indianred
indigo #4b0082 indigo
ivory #fffff0 ivory
khaki #f0e68c khaki
lavender #e6e6fa lavender
lavenderblush #fff0f5 lavenderblush
lawngreen #7cfc00 lawngreen
lemonchiffon #fffacd lemonchiffon
lightblue #add8e6 lightblue
lightcoral #f08080 lightcoral
lightcyan #e0ffff lightcyan
lightgoldenrodyellow #fafad2 lightgoldenrodyellow
lightgray #d3d3d3 lightgray
lightgreen #90ee90 lightgreen
lightpink #ffb6c1 lightpink
lightsalmon #ffa07a lightsalmon
lightseagreen #20b2aa lightseagreen
lightskyblue #87cefa lightskyblue
lightslategray #778899 lightslategray
lightslategrey #778899 lightslategrey
lightsteelblue #b0c4de lightsteelblue
lightyellow #ffffe0 lightyellow
lime #00ff00 lime
limegreen #32cd32 limegreen
linen #faf0e6 linen
magenta #ff00ff magenta
maroon #800000 maroon
mediumaquamarine #66cdaa mediumaquamarine
mediumblue #0000cd mediumblue
mediumorchid #ba55d3 mediumorchid
mediumpurple #9370db mediumpurple
mediumseagreen #3cb371 mediumseagreen
mediumslateblue #7b68ee mediumslateblue
mediumspringgreen #00fa9a mediumspringgreen
mediumturquoise #48d1cc mediumturquoise
mediumvioletred #c71585 mediumvioletred
midnightblue #191970 midnightblue
mintcream #f5fffa mintcream
mistyrose #ffe4e1 mistyrose
moccasin #ffe4b5 moccasin
navajowhite #ffdead navajowhite
navy #000080 navy
oldlace #fdf5e6 oldlace
olive #808000 olive
olivedrab #6b8e23 olivedrab
orange #ffa500 orange
orangered #ff4500 orangered
orchid #da70d6 orchid
palegoldenrod #eee8aa palegoldenrod
palegreen #98fb98 palegreen
paleturquoise #afeeee paleturquoise
palevioletred #db7093 palevioletred
papayawhip #ffefd5 papayawhip
peachpuff #ffdab9 peachpuff
peru #cd853f peru
pink #ffc0cb pink
plum #dda0dd plum
powderblue #b0e0e6 powderblue
purple #800080 purple
rebeccapurple #663399 rebeccapurple
red #ff0000 red
rosybrown #bc8f8f rosybrown
royalblue #4169e1 royalblue
saddlebrown #8b4513 saddlebrown
salmon #fa8072 salmon
sandybrown #f4a460 sandybrown
seagreen #2e8b57 seagreen
seashell #fff5ee seashell
sienna #a0522d sienna
silver #c0c0c0 silver
skyblue #87ceeb skyblue
slateblue #6a5acd slateblue
slategray #708090 slategray
slategrey #708090 slategray
snow #fffafa snow
springgreen #00ff7f springgreen
steelblue #4682b4 steelblue
tan #d2b48c tan
teal #008080 teal
thistle #d8Bfd8 thistle
tomato #ff6347 tomato
turquoise #40e0d0 turquoise
violet #ee82ee violet
wheat #f5deb3 wheat
white #ffffff white
whitesmoke #f5f5f5 whitesmoke
yellow #ffff00 yellow
yellowgreen #9acd32 yellowgreen

你可能感兴趣的鸿蒙文章

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

0  赞