Lesson 50 of 50 · Reference

Style vocabulary reference

Every property you can write in the page language is in this table, and every one works on both targets, web and native. Persian names are shown under the English ones.

States

Any style property can carry one state prefix and then applies only in that state, for example hover background = #ffeecc. The states are hover, focus, focus within, active, disabled, checked, invalid, placeholder and selection.

Value forms

  • A bare number uses the natural unit of the property: pixels for lengths, milliseconds for times, degrees for angles.
  • Percent: 50%. Units: px em rem fr vw vh ms s deg turn.
  • A comma list continues one property: padding = 8, 16. Brackets group one item of a repeated property: shadow = [0, 4, 8, black], [0, 1, 2, red].
  • Colours: red, #3366aa, rgb(51, 102, 170), hsl(210, 50%, 40%), mix(red, blue, 30%), light dark(white, black).

Layout of children

These properties go on the element that holds the children.

PropertyValuesDefaultAnimatesInheritedExample
layout
چیدمان
column row grid stack flow (keyword)columnnonolayout = row
gap
شکاف
length0yesnogap = 8, 16
align
تراز
start center end stretch baseline (keyword)stretchnonoalign = center
justify
چینش
start center end between around evenly (keyword)startnonojustify = between
align content
محتوا تراز
start center end stretch between around evenly (keyword)startnonoalign content = center
wrap
پیچش
true or falsefalsenonowrap = true
reverse
معکوس
true or falsefalsenonoreverse = true
columns
ستون‌ها
none auto min content max content (track list)nonenonocolumns = 200, 1fr
rows
ردیف‌ها
none auto min content max content (track list)nonenonorows = auto, 1fr
auto columns
ستون‌های خودکار
auto min content max content (track list)autononoauto columns = 1fr
auto rows
ردیف‌های خودکار
auto min content max content (track list)autononoauto rows = 100
auto flow
جریان خودکار
row column dense row dense column dense (keyword)rownonoauto flow = column

A child in its parent

These properties go on a child and say how it behaves inside its parent.

PropertyValuesDefaultAnimatesInheritedExample
grow
رشد
number0yesnogrow = 1
shrink
جمع‌شدن
number1yesnoshrink = 0
basis
پایه
auto (length)autoyesnobasis = 200
align self
خود تراز
auto start center end stretch baseline (keyword)autononoalign self = end
justify self
خود چینش
auto start center end stretch (keyword)autononojustify self = center
column
ستون
auto (integer)autononocolumn = 2
row
ردیف
auto (integer)autononorow = 1
column span
گستره ستون
integer1nonocolumn span = 2
row span
گستره ردیف
integer1nonorow span = 3
order
ترتیب نمایش
integer0nonoorder = -1
position
موقعیت
normal absolute fixed sticky (keyword)normalnonoposition = absolute
top
بالا
auto (length)autoyesnotop = 10
bottom
پایین
auto (length)autoyesnobottom = 10
start
ابتدا
auto (length)autoyesnostart = 10
end
انتها
auto (length)autoyesnoend = 10
left
چپ
auto (length)autoyesnoleft = 10
right
راست
auto (length)autoyesnoright = 10
inset
فاصله از لبه
auto (length)autoyesnoinset = 0
layer
لایه
integer0nonolayer = 2

Box

Size, space, and what happens to content that does not fit.

PropertyValuesDefaultAnimatesInheritedExample
width
عرض
auto fill fit min content max content (length)autoyesnowidth = 50%
height
ارتفاع
auto fill fit min content max content (length)autoyesnoheight = 100% - 20
min width
کمینه عرض
auto fit min content max content (length)autoyesnomin width = 120
min height
کمینه ارتفاع
auto fit min content max content (length)autoyesnomin height = 40
max width
بیشینه عرض
none fit min content max content (length)noneyesnomax width = 600
max height
بیشینه ارتفاع
none fit min content max content (length)noneyesnomax height = 80vh
aspect ratio
نسبت ابعاد
none (number)noneyesnoaspect ratio = 1.5
padding
فاصله
length0yesnopadding = 8, 16
padding top
فاصله بالا
length0yesnopadding top = 12
padding bottom
فاصله پایین
length0yesnopadding bottom = 12
padding start
فاصله ابتدا
length0yesnopadding start = 12
padding end
فاصله انتها
length0yesnopadding end = 12
padding left
فاصله چپ
length0yesnopadding left = 12
padding right
فاصله راست
length0yesnopadding right = 12
padding x
فاصله افقی
length0yesnopadding x = 12
padding y
فاصله عمودی
length0yesnopadding y = 12
margin
فضا
auto (length)0yesnomargin = 0, auto
margin top
فضا بالا
auto (length)0yesnomargin top = 8
margin bottom
فضا پایین
auto (length)0yesnomargin bottom = 8
margin start
فضا ابتدا
auto (length)0yesnomargin start = 8
margin end
فضا انتها
auto (length)0yesnomargin end = 8
margin left
فضا چپ
auto (length)0yesnomargin left = 8
margin right
فضا راست
auto (length)0yesnomargin right = 8
margin x
فضا افقی
auto (length)0yesnomargin x = 8
margin y
فضا عمودی
auto (length)0yesnomargin y = 8
overflow
سرریز
visible hidden scroll auto (keyword)visiblenonooverflow = hidden
overflow x
سرریز افقی
visible hidden scroll auto (keyword)visiblenonooverflow x = auto
overflow y
سرریز عمودی
visible hidden scroll auto (keyword)visiblenonooverflow y = scroll
visible
نمایان
true or falsetruenonovisible = false
clip
برش
true or falsefalsenonoclip = true

Look

Backgrounds, borders, shadows, filters, transforms and the pointer.

PropertyValuesDefaultAnimatesInheritedExample
background
پس‌زمینه
none (paint)transparentyesnobackground = linear(90, #3366aa, white)
background size
اندازه پس‌زمینه
auto cover contain (length)autoyesnobackground size = cover
background position
موقعیت پس‌زمینه
center top bottom start end left right (length)start, topyesnobackground position = center
background repeat
تکرار پس‌زمینه
true false x y (keyword)falsenonobackground repeat = x
border
کادر
solid dashed dotted double none (width, style, colour)0, solid, currentyesnoborder = 1, solid, #3366aa
border top
کادر بالا
solid dashed dotted double none (width, style, colour)0, solid, currentyesnoborder top = 2, dashed, red
border bottom
کادر پایین
solid dashed dotted double none (width, style, colour)0, solid, currentyesnoborder bottom = 2, dashed, red
border start
کادر ابتدا
solid dashed dotted double none (width, style, colour)0, solid, currentyesnoborder start = 2, dashed, red
border end
کادر انتها
solid dashed dotted double none (width, style, colour)0, solid, currentyesnoborder end = 2, dashed, red
border left
کادر چپ
solid dashed dotted double none (width, style, colour)0, solid, currentyesnoborder left = 2, dashed, red
border right
کادر راست
solid dashed dotted double none (width, style, colour)0, solid, currentyesnoborder right = 2, dashed, red
border width
ضخامت کادر
length0yesnoborder width = 1, 0
border style
سبک کادر
solid dashed dotted double none (keyword)solidnonoborder style = dashed
border color
رنگ کادر
colourcurrentyesnoborder color = #cccccc
radius
گردی
length0yesnoradius = 8
radius top start
گردی بالا ابتدا
length0yesnoradius top start = 12
radius top end
گردی بالا انتها
length0yesnoradius top end = 12
radius bottom end
گردی پایین انتها
length0yesnoradius bottom end = 12
radius bottom start
گردی پایین ابتدا
length0yesnoradius bottom start = 12
outline
دورخط
solid dashed dotted double none (width, style, colour)0, solid, currentyesnooutline = 2, solid, #3366aa
outline offset
فاصله دورخط
length0yesnooutline offset = 2
shadow
سایه
none inset (x, y, blur, spread, colour)noneyesnoshadow = 0, 4, 8, #00000040
opacity
شفافیت
number1yesnoopacity = 0.5
blur
تاری
length0yesnoblur = 4
brightness
روشنایی
number1yesnobrightness = 1.2
contrast
کنتراست
number1yesnocontrast = 1.5
grayscale
خاکستری
number0yesnograyscale = 1
saturate
اشباع رنگ
number1yesnosaturate = 2
sepia
سپیا
number0yesnosepia = 0.6
invert
وارونگی
number0yesnoinvert = 1
hue rotate
چرخش فام
angle0yesnohue rotate = 90
backdrop blur
تاری پشت
length0yesnobackdrop blur = 4
backdrop brightness
روشنایی پشت
number1yesnobackdrop brightness = 1.2
backdrop contrast
کنتراست پشت
number1yesnobackdrop contrast = 1.5
backdrop grayscale
خاکستری پشت
number0yesnobackdrop grayscale = 1
backdrop saturate
اشباع رنگ پشت
number1yesnobackdrop saturate = 2
backdrop sepia
سپیا پشت
number0yesnobackdrop sepia = 0.6
backdrop invert
وارونگی پشت
number0yesnobackdrop invert = 1
backdrop hue rotate
چرخش فام پشت
angle0yesnobackdrop hue rotate = 90
blend
آمیختگی
normal multiply screen overlay darken lighten color dodge color burn hard light soft light difference exclusion hue saturation color luminosity (keyword)normalnonoblend = multiply
translate
جابه‌جایی
length0yesnotranslate = 10, -4
rotate
چرخش
angle0yesnorotate = 45
scale
مقیاس
number1yesnoscale = 1.5
skew
کجی
angle0yesnoskew = 10, 0
origin
مبدا
center top bottom start end left right (length)centeryesnoorigin = top, start
cursor
نشانگر
auto default none pointer text move grab grabbing not allowed wait progress crosshair help resize resize x resize y zoom in zoom out (keyword)autonoyescursor = pointer
interactive
تعاملی
true or falsetruenoyesinteractive = false
selectable
انتخاب‌پذیر
true or falsetruenoyesselectable = false
image fit
جاگیری تصویر
fill contain cover none scale down (keyword)fillnonoimage fit = cover
accent
رنگ تاکید
colour#1a73e8yesyesaccent = #3366aa
caret
رنگ نشانگر متن
colourcurrentyesyescaret = red
scrollbar
نوار پیمایش
auto thin none (keyword)autononoscrollbar = thin
scrollbar color
رنگ نوار پیمایش
colour#00000066, transparentyesyesscrollbar color = #888888, #eeeeee

Text

Text properties are inherited: set them on a box and every text inside takes them.

PropertyValuesDefaultAnimatesInheritedExample
color
رنگ
colour#000000yesyescolor = #333333
font
قلم
sans serif mono system (font family list)sansnoyesfont = "Vazirmatn", sans
font size
اندازه قلم
length16yesyesfont size = 1.25em
font weight
وزن قلم
thin light normal medium semibold bold black (number)normalyesyesfont weight = bold
italic
کج
true or falsefalsenoyesitalic = true
line height
ارتفاع خط
number1.5yesyesline height = 1.8
letter spacing
فاصله حروف
length0yesyesletter spacing = 0.05em
word spacing
فاصله واژه‌ها
length0yesyesword spacing = 4
text align
تراز متن
start center end justify left right (keyword)startnoyestext align = center
decoration
تزیین متن
none underline overline strike (keyword)nonenonodecoration = underline
decoration color
رنگ تزیین متن
colourcurrentyesnodecoration color = red
decoration style
سبک تزیین متن
solid dashed dotted double wavy (keyword)solidnonodecoration style = wavy
decoration thickness
ضخامت تزیین متن
auto (length)autoyesnodecoration thickness = 2
transform text
دگرگونی متن
none upper lower capitalize (keyword)nonenoyestransform text = upper
wrap text
پیچش متن
true or falsetruenoyeswrap text = false
max lines
بیشینه سطرها
none (integer)nonenonomax lines = 2
ellipsis
سه‌نقطه
true or falsefalsenonoellipsis = true
direction
جهت متن
auto rtl ltr (keyword)autonoyesdirection = rtl
white space
فضای سفید
normal keep (keyword)normalnoyeswhite space = keep
text shadow
سایه متن
none (x, y, blur, colour)noneyesyestext shadow = 0, 1, 2, #00000080
font features
ویژگی‌های قلم
none (list of strings)nonenoyesfont features = "tnum", "ss01"

Motion

A change of a property can take time instead of jumping.

PropertyValuesDefaultAnimatesInheritedExample
transition
گذار
none (time, easing, delay)nonenonotransition = 200ms, ease out
transition properties
ویژگی‌های گذار
all (property names)allnonotransition properties = opacity, background
tab size
اندازه تب
integer8noyestab size = 4
touch action
کنش لمس
auto none pan x pan y pinch manipulation (keyword)autononotouch action = pan y