xref: /vim-8.2.3635/runtime/syntax/css.vim (revision bb76f24a)
1" Vim syntax file
2" Language:     Cascading Style Sheets
3" Previous Contributor List:
4"               Claudio Fleiner <[email protected]> (Maintainer)
5"               Yeti            (Add full CSS2, HTML4 support)
6"               Nikolai Weibull (Add CSS2 support)
7" Maintainer:   Jules Wang      <[email protected]>
8" URL:          https://github.com/JulesWang/css.vim
9" Last Change:  2015 Apr.17
10
11" quit when a syntax file was already loaded
12if !exists("main_syntax")
13  if exists("b:current_syntax")
14    finish
15  endif
16  let main_syntax = 'css'
17elseif exists("b:current_syntax") && b:current_syntax == "css"
18  finish
19endif
20
21let s:cpo_save = &cpo
22set cpo&vim
23
24syn case ignore
25
26" HTML4 tags
27syn keyword cssTagName abbr address area a b base
28syn keyword cssTagName bdo blockquote body br button
29syn keyword cssTagName caption cite code col colgroup dd del
30syn keyword cssTagName dfn div dl dt em fieldset form
31syn keyword cssTagName h1 h2 h3 h4 h5 h6 head hr html img i
32syn keyword cssTagName iframe input ins isindex kbd label legend li
33syn keyword cssTagName link map menu meta noscript ol optgroup
34syn keyword cssTagName option p param pre q s samp script small
35syn keyword cssTagName span strong sub sup tbody td
36syn keyword cssTagName textarea tfoot th thead title tr ul u var
37syn keyword cssTagName object svg
38syn match   cssTagName /\<select\>\|\<style\>\|\<table\>/
39
40" 34 HTML5 tags
41syn keyword cssTagName article aside audio bdi canvas command data
42syn keyword cssTagName datalist details dialog embed figcaption figure footer
43syn keyword cssTagName header hgroup keygen main mark menuitem meter nav
44syn keyword cssTagName output progress rt rp ruby section
45syn keyword cssTagName source summary time track video wbr
46
47" Tags not supported in HTML5
48" acronym applet basefont big center dir
49" font frame frameset noframes strike tt
50
51syn match cssTagName "\*"
52
53" selectors
54syn match cssSelectorOp "[,>+~]"
55syn match cssSelectorOp2 "[~|^$*]\?=" contained
56syn region cssAttributeSelector matchgroup=cssSelectorOp start="\[" end="]" contains=cssUnicodeEscape,cssSelectorOp2,cssStringQ,cssStringQQ
57
58" .class and #id
59syn match cssClassName "\.[A-Za-z][A-Za-z0-9_-]\+" contains=cssClassNameDot
60syn match cssClassNameDot contained '\.'
61
62try
63syn match cssIdentifier "#[A-Za-z�-�_@][A-Za-z�-�0-9_@-]*"
64catch /^.*/
65syn match cssIdentifier "#[A-Za-z_@][A-Za-z0-9_@-]*"
66endtry
67
68" digits
69syn match cssValueInteger contained "[-+]\=\d\+" contains=cssUnitDecorators
70syn match cssValueNumber contained "[-+]\=\d\+\(\.\d*\)\=" contains=cssUnitDecorators
71syn match cssValueLength contained "[-+]\=\d\+\(\.\d*\)\=\(%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|rem\|dpi\|dppx\|dpcm\)\>" contains=cssUnitDecorators
72syn match cssValueAngle contained "[-+]\=\d\+\(\.\d*\)\=\(deg\|grad\|rad\)\>" contains=cssUnitDecorators
73syn match cssValueTime contained "+\=\d\+\(\.\d*\)\=\(ms\|s\)\>" contains=cssUnitDecorators
74syn match cssValueFrequency contained "+\=\d\+\(\.\d*\)\=\(Hz\|kHz\)\>" contains=cssUnitDecorators
75
76
77syn match cssIncludeKeyword /@\(-[a-z]\+-\)\=\(media\|keyframes\|import\|charset\|namespace\|page\)/ contained
78" @media
79syn region cssInclude start=/@media\>/ end=/\ze{/ skipwhite skipnl contains=cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType,cssIncludeKeyword,cssMediaComma,cssComment nextgroup=cssMediaBlock
80syn keyword cssMediaType contained screen print aural braille embossed handheld projection tty tv speech all contained skipwhite skipnl
81syn keyword cssMediaKeyword only not and contained
82syn region cssMediaBlock transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssTagName,cssClassName,cssIdentifier,cssPseudoClass,cssSelectorOp,cssSelectorOp2,cssAttributeSelector fold
83syn match cssMediaComma "," skipwhite skipnl contained
84
85" Reference: http://www.w3.org/TR/css3-mediaqueries/
86syn keyword cssMediaProp contained width height orientation scan grid
87syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(\(device\)-\)\=aspect-ratio/
88syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-pixel-ratio/
89syn match cssMediaProp contained /\(\(max\|min\)-\)\=device-\(height\|width\)/
90syn match cssMediaProp contained /\(\(max\|min\)-\)\=\(height\|width\|resolution\|monochrome\|color\(-index\)\=\)/
91syn keyword cssMediaAttr contained portrait landscape progressive interlace
92
93" @page
94" http://www.w3.org/TR/css3-page/
95syn match cssPage "@page\>[^{]*{\@=" contains=cssPagePseudo,cssIncludeKeyword nextgroup=cssPageWrap transparent skipwhite skipnl
96syn match cssPagePseudo /:\(left\|right\|first\|blank\)/ contained skipwhite skipnl
97syn region cssPageWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssPageMargin,cssPageProp,cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks
98syn match cssPageMargin /@\(\(top\|left\|right\|bottom\)-\(left\|center\|right\|middle\|bottom\)\)\(-corner\)\=/ contained nextgroup=cssDefinition skipwhite skipnl
99syn keyword cssPageProp contained content size
100" http://www.w3.org/TR/CSS2/page.html#break-inside
101syn keyword cssPageProp contained orphans widows
102
103" @keyframe
104" http://www.w3.org/TR/css3-animations/#keyframes
105syn match cssKeyFrame "@\(-[a-z]\+-\)\=keyframes\>[^{]*{\@=" nextgroup=cssKeyFrameWrap contains=cssVendor,cssIncludeKeyword skipwhite skipnl transparent
106syn region cssKeyFrameWrap contained transparent matchgroup=cssBraces start="{" end="}" contains=cssKeyFrameSelector
107syn match cssKeyFrameSelector /\(\d*%\|from\|to\)\=/  contained skipwhite skipnl nextgroup=cssDefinition
108
109" @import
110syn region cssInclude start=/@import\>/    end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword,cssURL,cssMediaProp,cssValueLength,cssMediaKeyword,cssValueInteger,cssMediaAttr,cssVendor,cssMediaType
111syn region cssInclude start=/@charset\>/   end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword
112syn region cssInclude start=/@namespace\>/ end=/\ze;/ transparent contains=cssStringQ,cssStringQQ,cssUnicodeEscape,cssComment,cssIncludeKeyword
113
114" @font-face
115" http://www.w3.org/TR/css3-fonts/#at-font-face-rule
116syn match cssFontDescriptor "@font-face\>" nextgroup=cssFontDescriptorBlock skipwhite skipnl
117syn region cssFontDescriptorBlock contained transparent matchgroup=cssBraces start="{" end="}" contains=cssComment,cssError,cssUnicodeEscape,cssCommonAttr,cssFontDescriptorProp,cssValue.*,cssFontDescriptorFunction,cssFontDescriptorAttr,cssNoise
118
119syn match cssFontDescriptorProp contained "\<font-family\>"
120syn keyword cssFontDescriptorProp contained src
121syn match cssFontDescriptorProp contained "\<font-\(style\|weight\|stretch\)\>"
122syn match cssFontDescriptorProp contained "\<unicode-range\>"
123syn match cssFontDescriptorProp contained "\<font-\(variant\|feature-settings\)\>"
124
125" src functions
126syn region cssFontDescriptorFunction contained matchgroup=cssFunctionName start="\<\(uri\|url\|local\|format\)\s*(" end=")" contains=cssStringQ,cssStringQQ oneline keepend
127" font-sytle and font-weight attributes
128syn keyword cssFontDescriptorAttr contained normal italic oblique bold
129" font-stretch attributes
130syn match cssFontDescriptorAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>"
131" unicode-range attributes
132syn match cssFontDescriptorAttr contained "U+[0-9A-Fa-f?]\+"
133syn match cssFontDescriptorAttr contained "U+\x\+-\x\+"
134" font-feature-settings attributes
135syn keyword cssFontDescriptorAttr contained on off
136
137
138
139" The 16 basic color names
140syn keyword cssColor contained aqua black blue fuchsia gray green lime maroon navy olive purple red silver teal yellow
141
142" 130 more color names
143syn keyword cssColor contained aliceblue antiquewhite aquamarine azure
144syn keyword cssColor contained beige bisque blanchedalmond blueviolet brown burlywood
145syn keyword cssColor contained cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan
146syn match cssColor contained /\<dark\(blue\|cyan\|goldenrod\|gray\|green\|grey\|khaki\)\>/
147syn match cssColor contained /\<dark\(magenta\|olivegreen\|orange\|orchid\|red\|salmon\|seagreen\)\>/
148syn match cssColor contained /\<darkslate\(blue\|gray\|grey\)\>/
149syn match cssColor contained /\<dark\(turquoise\|violet\)\>/
150syn keyword cssColor contained deeppink deepskyblue dimgray dimgrey dodgerblue firebrick
151syn keyword cssColor contained floralwhite forestgreen gainsboro ghostwhite gold
152syn keyword cssColor contained goldenrod greenyellow grey honeydew hotpink
153syn keyword cssColor contained indianred indigo ivory khaki lavender lavenderblush lawngreen
154syn keyword cssColor contained lemonchiffon limegreen linen magenta
155syn match cssColor contained /\<light\(blue\|coral\|cyan\|goldenrodyellow\|gray\|green\)\>/
156syn match cssColor contained /\<light\(grey\|pink\|salmon\|seagreen\|skyblue\|yellow\)\>/
157syn match cssColor contained /\<light\(slategray\|slategrey\|steelblue\)\>/
158syn match cssColor contained /\<medium\(aquamarine\|blue\|orchid\|purple\|seagreen\)\>/
159syn match cssColor contained /\<medium\(slateblue\|springgreen\|turquoise\|violetred\)\>/
160syn keyword cssColor contained midnightblue mintcream mistyrose moccasin navajowhite
161syn keyword cssColor contained oldlace olivedrab orange orangered orchid
162syn match cssColor contained /\<pale\(goldenrod\|green\|turquoise\|violetred\)\>/
163syn keyword cssColor contained papayawhip peachpuff peru pink plum powderblue
164syn keyword cssColor contained rosybrown royalblue saddlebrown salmon sandybrown
165syn keyword cssColor contained seagreen seashell sienna skyblue slateblue
166syn keyword cssColor contained slategray slategrey snow springgreen steelblue tan
167syn keyword cssColor contained thistle tomato turquoise violet wheat
168syn keyword cssColor contained whitesmoke yellowgreen
169
170" FIXME: These are actually case-insensitive too, but (a) specs recommend using
171" mixed-case (b) it's hard to highlight the word `Background' correctly in
172" all situations
173syn case match
174syn keyword cssColor contained ActiveBorder ActiveCaption AppWorkspace ButtonFace ButtonHighlight ButtonShadow ButtonText CaptionText GrayText Highlight HighlightText InactiveBorder InactiveCaption InactiveCaptionText InfoBackground InfoText Menu MenuText Scrollbar ThreeDDarkShadow ThreeDFace ThreeDHighlight ThreeDLightShadow ThreeDShadow Window WindowFrame WindowText Background
175syn case ignore
176
177syn match cssImportant contained "!\s*important\>"
178
179syn match cssColor contained "\<transparent\>"
180syn match cssColor contained "\<currentColor\>"
181syn match cssColor contained "\<white\>"
182syn match cssColor contained "#[0-9A-Fa-f]\{3\}\>" contains=cssUnitDecorators
183syn match cssColor contained "#[0-9A-Fa-f]\{6\}\>" contains=cssUnitDecorators
184
185syn region cssURL contained matchgroup=cssFunctionName start="\<url\s*(" end=")" contains=cssStringQ,cssStringQQ oneline
186syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgb\|clip\|attr\|counter\|rect\|cubic-bezier\|steps\)\s*(" end=")" oneline  contains=cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma
187syn region cssFunction contained matchgroup=cssFunctionName start="\<\(rgba\|hsl\|hsla\|color-stop\|from\|to\)\s*(" end=")" oneline  contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunctionComma,cssFunction
188syn region cssFunction contained matchgroup=cssFunctionName start="\<\(linear-\|radial-\)\=\gradient\s*(" end=")" oneline  contains=cssColor,cssValueInteger,cssValueNumber,cssValueLength,cssFunction,cssGradientAttr,cssFunctionComma
189syn region cssFunction contained matchgroup=cssFunctionName start="\<\(matrix\(3d\)\=\|scale\(3d\|X\|Y\|Z\)\=\|translate\(3d\|X\|Y\|Z\)\=\|skew\(X\|Y\)\=\|rotate\(3d\|X\|Y\|Z\)\=\|perspective\)\s*(" end=")" oneline contains=cssValueInteger,cssValueNumber,cssValueLength,cssValueAngle,cssFunctionComma
190syn keyword cssGradientAttr contained top bottom left right cover center middle ellipse at
191syn match cssFunctionComma contained ","
192
193" Common Prop and Attr
194syn keyword cssCommonAttr contained auto none inherit all default normal
195syn keyword cssCommonAttr contained top bottom center stretch hidden visible
196"------------------------------------------------
197" CSS Animations
198" http://www.w3.org/TR/css3-animations/
199syn match cssAnimationProp contained "\<animation\(-\(delay\|direction\|duration\|fill-mode\|name\|play-state\|timing-function\|iteration-count\)\)\=\>"
200
201" animation-direction attributes
202syn keyword cssAnimationAttr contained alternate reverse
203syn match cssAnimationAttr contained "\<alternate-reverse\>"
204
205" animation-fill-mode attributes
206syn keyword cssAnimationAttr contained forwards backwards both
207
208" animation-play-state attributes
209syn keyword cssAnimationAttr contained running paused
210
211" animation-iteration-count attributes
212syn keyword cssAnimationAttr contained infinite
213"------------------------------------------------
214"  CSS Backgrounds and Borders Module Level 3
215"  http://www.w3.org/TR/css3-background/
216syn match cssBackgroundProp contained "\<background\(-\(attachment\|clip\|color\|image\|origin\|position\|repeat\|size\)\)\=\>"
217" background-attachment attributes
218syn keyword cssBackgroundAttr contained scroll fixed local
219
220" background-position attributes
221syn keyword cssBackgroundAttr contained left center right top bottom
222
223" background-repeat attributes
224syn match cssBackgroundAttr contained "\<no-repeat\>"
225syn match cssBackgroundAttr contained "\<repeat\(-[xy]\)\=\>"
226syn keyword cssBackgroundAttr contained space round
227
228" background-size attributes
229syn keyword cssBackgroundAttr contained cover contain
230
231syn match cssBorderProp contained "\<border\(-\(top\|right\|bottom\|left\)\)\=\(-\(width\|color\|style\)\)\=\>"
232syn match cssBorderProp contained "\<border\(-\(top\|bottom\)-\(left\|right\)\)\=-radius\>"
233syn match cssBorderProp contained "\<border-image\(-\(outset\|repeat\|slice\|source\|width\)\)\=\>"
234syn match cssBorderProp contained "\<box-decoration-break\>"
235syn match cssBorderProp contained "\<box-shadow\>"
236
237" border-image attributes
238syn keyword cssBorderAttr contained stretch round space fill
239
240" border-style attributes
241syn keyword cssBorderAttr contained dotted dashed solid double groove ridge inset outset
242
243" border-width attributes
244syn keyword cssBorderAttr contained thin thick medium
245
246" box-decoration-break attributes
247syn keyword cssBorderAttr contained clone slice
248"------------------------------------------------
249
250syn match cssBoxProp contained "\<padding\(-\(top\|right\|bottom\|left\)\)\=\>"
251syn match cssBoxProp contained "\<margin\(-\(top\|right\|bottom\|left\)\)\=\>"
252syn match cssBoxProp contained "\<overflow\(-\(x\|y\|style\)\)\=\>"
253syn match cssBoxProp contained "\<rotation\(-point\)\=\>"
254syn keyword cssBoxAttr contained visible hidden scroll auto
255syn match cssBoxAttr contained "\<no-\(display\|content\)\>"
256
257syn keyword cssColorProp contained opacity
258syn match cssColorProp contained "\<color-profile\>"
259syn match cssColorProp contained "\<rendering-intent\>"
260
261
262syn match cssDimensionProp contained "\<\(min\|max\)-\(width\|height\)\>"
263syn keyword cssDimensionProp contained height
264syn keyword cssDimensionProp contained width
265
266" shadow and sizing are in other property groups
267syn match cssFlexibleBoxProp contained "\<box-\(align\|direction\|flex\|ordinal-group\|orient\|pack\|shadow\|sizing\)\>"
268syn keyword cssFlexibleBoxAttr contained start end baseline
269syn keyword cssFlexibleBoxAttr contained reverse
270syn keyword cssFlexibleBoxAttr contained single multiple
271syn keyword cssFlexibleBoxAttr contained horizontal
272syn match cssFlexibleBoxAttr contained "\<vertical\(-align\)\@!\>" "escape vertical-align
273syn match cssFlexibleBoxAttr contained "\<\(inline\|block\)-axis\>"
274
275" CSS Fonts Module Level 3
276" http://www.w3.org/TR/css-fonts-3/
277syn match cssFontProp contained "\<font\(-\(family\|\|feature-settings\|kerning\|language-override\|size\(-adjust\)\=\|stretch\|style\|synthesis\|variant\(-\(alternates\|caps\|east-asian\|ligatures\|numeric\|position\)\)\=\|weight\)\)\=\>"
278
279" font attributes
280syn keyword cssFontAttr contained icon menu caption
281syn match cssFontAttr contained "\<small-\(caps\|caption\)\>"
282syn match cssFontAttr contained "\<message-box\>"
283syn match cssFontAttr contained "\<status-bar\>"
284syn keyword cssFontAttr contained larger smaller
285syn match cssFontAttr contained "\<\(x\{1,2\}-\)\=\(large\|small\)\>"
286" font-family attributes
287syn match cssFontAttr contained "\<\(sans-\)\=serif\>"
288syn keyword cssFontAttr contained Antiqua Arial Black Book Charcoal Comic Courier Dingbats Gadget Geneva Georgia Grande Helvetica Impact Linotype Lucida MS Monaco Neue New Palatino Roboto Roman Symbol Tahoma Times Trebuchet Verdana Webdings Wingdings York Zapf
289syn keyword cssFontAttr contained cursive fantasy monospace
290" font-feature-settings attributes
291syn keyword cssFontAttr contained on off
292" font-stretch attributes
293syn match cssFontAttr contained "\<\(\(ultra\|extra\|semi\)-\)\=\(condensed\|expanded\)\>"
294" font-style attributes
295syn keyword cssFontAttr contained italic oblique
296" font-synthesis attributes
297syn keyword cssFontAttr contained weight style
298" font-weight attributes
299syn keyword cssFontAttr contained bold bolder lighter
300" TODO: font-variant-* attributes
301"------------------------------------------------
302
303" Webkit specific property/attributes
304syn match cssFontProp contained "\<font-smooth\>"
305syn match cssFontAttr contained "\<\(subpixel-\)\=\antialiased\>"
306
307
308" CSS Multi-column Layout Module
309" http://www.w3.org/TR/css3-multicol/
310syn match cssMultiColumnProp contained "\<break-\(after\|before\|inside\)\>"
311syn match cssMultiColumnProp contained "\<column-\(count\|fill\|gap\|rule\(-\(color\|style\|width\)\)\=\|span\|width\)\>"
312syn keyword cssMultiColumnProp contained columns
313syn keyword cssMultiColumnAttr contained balance medium
314syn keyword cssMultiColumnAttr contained always avoid left right page column
315syn match cssMultiColumnAttr contained "\<avoid-\(page\|column\)\>"
316
317" http://www.w3.org/TR/css3-break/#page-break
318syn match cssMultiColumnProp contained "\<page\(-break-\(before\|after\|inside\)\)\=\>"
319
320" TODO find following items in w3c docs.
321syn keyword cssGeneratedContentProp contained quotes crop
322syn match cssGeneratedContentProp contained "\<counter-\(reset\|increment\)\>"
323syn match cssGeneratedContentProp contained "\<move-to\>"
324syn match cssGeneratedContentProp contained "\<page-policy\>"
325syn match cssGeneratedContentAttr contained "\<\(no-\)\=\(open\|close\)-quote\>"
326
327syn match cssGridProp contained "\<grid-\(columns\|rows\)\>"
328
329syn match cssHyerlinkProp contained "\<target\(-\(name\|new\|position\)\)\=\>"
330
331syn match cssListProp contained "\<list-style\(-\(type\|position\|image\)\)\=\>"
332syn match cssListAttr contained "\<\(lower\|upper\)-\(roman\|alpha\|greek\|latin\)\>"
333syn match cssListAttr contained "\<\(hiragana\|katakana\)\(-iroha\)\=\>"
334syn match cssListAttr contained "\<\(decimal\(-leading-zero\)\=\|cjk-ideographic\)\>"
335syn keyword cssListAttr contained disc circle square hebrew armenian georgian
336syn keyword cssListAttr contained inside outside
337
338syn keyword cssPositioningProp contained bottom clear clip display float left
339syn keyword cssPositioningProp contained position right top visibility
340syn match cssPositioningProp contained "\<z-index\>"
341syn keyword cssPositioningAttr contained block compact
342syn match cssPositioningAttr contained "\<table\(-\(row-group\|\(header\|footer\)-group\|row\|column\(-group\)\=\|cell\|caption\)\)\=\>"
343syn keyword cssPositioningAttr contained left right both
344syn match cssPositioningAttr contained "\<list-item\>"
345syn match cssPositioningAttr contained "\<inline\(-\(block\|box\|table\)\)\=\>"
346syn keyword cssPositioningAttr contained static relative absolute fixed
347
348syn keyword cssPrintAttr contained landscape portrait crop cross always avoid
349
350syn match cssTableProp contained "\<\(caption-side\|table-layout\|border-collapse\|border-spacing\|empty-cells\)\>"
351syn keyword cssTableAttr contained fixed collapse separate show hide once always
352
353
354syn keyword cssTextProp contained color direction
355syn match cssTextProp "\<\(\(word\|letter\)-spacing\|text\(-\(decoration\|transform\|align\|index\|shadow\)\)\=\|vertical-align\|unicode-bidi\|line-height\)\>"
356syn match cssTextProp contained "\<text-\(justify\|outline\|warp\|align-last\|size-adjust\|rendering\|stroke\|indent\)\>"
357syn match cssTextProp contained "\<word-\(break\|\wrap\)\>"
358syn match cssTextProp contained "\<white-space\>"
359syn match cssTextProp contained "\<hanging-punctuation\>"
360syn match cssTextProp contained "\<punctuation-trim\>"
361syn match cssTextAttr contained "\<line-through\>"
362syn match cssTextAttr contained "\<\(text-\)\=\(top\|bottom\)\>"
363syn keyword cssTextAttr contained ltr rtl embed nowrap
364syn keyword cssTextAttr contained underline overline blink sub super middle
365syn keyword cssTextAttr contained capitalize uppercase lowercase
366syn keyword cssTextAttr contained justify baseline sub super
367syn keyword cssTextAttr contained optimizeLegibility optimizeSpeed
368syn match cssTextAttr contained "\<pre\(-\(line\|wrap\)\)\=\>"
369syn match cssTextAttr contained "\<\(allow\|force\)-end\>"
370syn keyword cssTextAttr contained start end adjacent
371syn match cssTextAttr contained "\<inter-\(word\|ideographic\|cluster\)\>"
372syn keyword cssTextAttr contained distribute kashida first last
373syn keyword cssTextAttr contained clip ellipsis unrestricted suppress
374syn match cssTextAttr contained "\<break-all\>"
375syn match cssTextAttr contained "\<break-word\>"
376syn keyword cssTextAttr contained hyphenate
377syn match cssTextAttr contained "\<bidi-override\>"
378
379syn match cssTransformProp contained "\<transform\(-\(origin\|style\)\)\=\>"
380syn match cssTransformProp contained "\<perspective\(-origin\)\=\>"
381syn match cssTransformProp contained "\<backface-visibility\>"
382
383" CSS Transitions
384" http://www.w3.org/TR/css3-transitions/
385syn match cssTransitionProp contained "\<transition\(-\(delay\|duration\|property\|timing-function\)\)\=\>"
386
387" transition-time-function attributes
388syn match cssTransitionAttr contained "\<linear\(-gradient\)\@!\>"
389syn match cssTransitionAttr contained "\<ease\(-\(in-out\|out\|in\)\)\=\>"
390syn match cssTransitionAttr contained "\<step\(-start\|-end\)\=\>"
391"------------------------------------------------
392" CSS Basic User Interface Module Level 3 (CSS3 UI)
393" http://www.w3.org/TR/css3-ui/
394syn match cssUIProp contained "\<box-sizing\>"
395syn match cssUIAttr contained "\<\(content\|padding\|border\)\(-box\)\=\>"
396
397syn keyword cssUIProp contained cursor
398syn match cssUIAttr contained "\<\(\([ns]\=[ew]\=\)\|col\|row\|nesw\|nwse\)-resize\>"
399syn keyword cssUIAttr contained crosshair help move pointer alias copy
400syn keyword cssUIAttr contained progress wait text cell move
401syn match cssUIAttr contained "\<context-menu\>"
402syn match cssUIAttr contained "\<no-drop\>"
403syn match cssUIAttr contained "\<not-allowed\>"
404syn match cssUIAttr contained "\<all-scroll\>"
405syn match cssUIAttr contained "\<\(vertical-\)\=text\>"
406syn match cssUIAttr contained "\<zoom\(-in\|-out\)\=\>"
407
408syn match cssUIProp contained "\<ime-mode\>"
409syn keyword cssUIAttr contained active inactive disabled
410
411syn match cssUIProp contained "\<nav-\(down\|index\|left\|right\|up\)\=\>"
412syn match cssUIProp contained "\<outline\(-\(width\|style\|color\|offset\)\)\=\>"
413syn keyword cssUIAttr contained invert
414
415syn keyword cssUIProp contained icon resize
416syn keyword cssUIAttr contained both horizontal vertical
417
418syn match cssUIProp contained "\<text-overflow\>"
419syn keyword cssUIAttr contained clip ellipsis
420
421" Already highlighted Props: font content
422"------------------------------------------------
423" Webkit/iOS specific attributes
424syn match cssUIAttr contained '\(preserve-3d\)'
425" IE specific attributes
426syn match cssIEUIAttr contained '\(bicubic\)'
427
428" Webkit/iOS specific properties
429syn match cssUIProp contained '\(tap-highlight-color\|user-select\|touch-callout\)'
430" IE specific properties
431syn match cssIEUIProp contained '\(interpolation-mode\|zoom\|filter\)'
432
433" Webkit/Firebox specific properties/attributes
434syn keyword cssUIProp contained appearance
435syn keyword cssUIAttr contained window button field icon document menu
436
437
438syn match cssAuralProp contained "\<\(pause\|cue\)\(-\(before\|after\)\)\=\>"
439syn match cssAuralProp contained "\<\(play-during\|speech-rate\|voice-family\|pitch\(-range\)\=\|speak\(-\(punctuation\|numeral\|header\)\)\=\)\>"
440syn keyword cssAuralProp contained volume during azimuth elevation stress richness
441syn match cssAuralAttr contained "\<\(x-\)\=\(soft\|loud\)\>"
442syn keyword cssAuralAttr contained silent
443syn match cssAuralAttr contained "\<spell-out\>"
444syn keyword cssAuralAttr contained non mix
445syn match cssAuralAttr contained "\<\(left\|right\)-side\>"
446syn match cssAuralAttr contained "\<\(far\|center\)-\(left\|center\|right\)\>"
447syn keyword cssAuralAttr contained leftwards rightwards behind
448syn keyword cssAuralAttr contained below level above lower higher
449syn match cssAuralAttr contained "\<\(x-\)\=\(slow\|fast\|low\|high\)\>"
450syn keyword cssAuralAttr contained faster slower
451syn keyword cssAuralAttr contained male female child code digits continuous
452
453" mobile text
454syn match cssMobileTextProp contained "\<text-size-adjust\>"
455
456
457
458syn match cssBraces contained "[{}]"
459syn match cssError contained "{@<>"
460syn region cssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=cssAttrRegion,css.*Prop,cssComment,cssValue.*,cssColor,cssURL,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssVendor,cssDefinition,cssHacks,cssNoise fold
461syn match cssBraceError "}"
462syn match cssAttrComma ","
463
464" Pseudo class
465" http://www.w3.org/TR/css3-selectors/
466syn match cssPseudoClass ":[A-Za-z0-9_-]*" contains=cssNoise,cssPseudoClassId,cssUnicodeEscape,cssVendor,cssPseudoClassFn
467syn keyword cssPseudoClassId contained link visited active hover before after left right
468syn keyword cssPseudoClassId contained root empty target enable disabled checked invalid
469syn match cssPseudoClassId contained "\<first-\(line\|letter\)\>"
470syn match cssPseudoClassId contained "\<\(first\|last\|only\)-\(of-type\|child\)\>"
471syn region cssPseudoClassFn contained matchgroup=cssFunctionName start="\<\(not\|lang\|\(nth\|nth-last\)-\(of-type\|child\)\)(" end=")"
472" ------------------------------------
473" Vendor specific properties
474syn match cssPseudoClassId contained  "\<selection\>"
475syn match cssPseudoClassId contained  "\<focus\(-inner\)\=\>"
476syn match cssPseudoClassId contained  "\<\(input-\)\=placeholder\>"
477
478" Misc highlight groups
479syntax match cssUnitDecorators /\(#\|-\|%\|mm\|cm\|in\|pt\|pc\|em\|ex\|px\|ch\|rem\|vh\|vw\|vmin\|vmax\|dpi\|dppx\|dpcm\|Hz\|kHz\|s\|ms\|deg\|grad\|rad\)/ contained
480syntax match cssNoise contained /\(:\|;\|\/\)/
481
482" Comment
483syn region cssComment start="/\*" end="\*/" contains=@Spell fold
484
485syn match cssUnicodeEscape "\\\x\{1,6}\s\?"
486syn match cssSpecialCharQQ +\\\\\|\\"+ contained
487syn match cssSpecialCharQ +\\\\\|\\'+ contained
488syn region cssStringQQ start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=cssUnicodeEscape,cssSpecialCharQQ
489syn region cssStringQ start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=cssUnicodeEscape,cssSpecialCharQ
490
491" Vendor Prefix
492syn match cssVendor contained "\(-\(webkit\|moz\|o\|ms\)-\)"
493
494" Various CSS Hack characters
495" In earlier versions of IE (6 and 7), one can prefix property names
496" with a _ or * to isolate those definitions to particular versions of IE
497" This is purely decorative and therefore we assign to the same highlight
498" group to cssVendor, for more information:
499" http://www.paulirish.com/2009/browser-specific-css-hacks/
500syn match cssHacks contained /\(_\|*\)/
501
502" Attr Enhance
503" Some keywords are both Prop and Attr, so we have to handle them
504syn region cssAttrRegion start=/:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
505
506" Hack for transition
507" 'transition' has Props after ':'.
508syn region cssAttrRegion start=/transition\s*:/ end=/\ze\(;\|)\|}\)/ contained contains=css.*Prop,css.*Attr,cssColor,cssImportant,cssValue.*,cssFunction,cssString.*,cssURL,cssComment,cssUnicodeEscape,cssVendor,cssError,cssAttrComma,cssNoise
509
510
511if main_syntax == "css"
512  syn sync minlines=10
513endif
514
515" Define the default highlighting.
516" Only when an item doesn't have highlighting yet
517
518hi def link cssComment Comment
519hi def link cssVendor Comment
520hi def link cssHacks Comment
521hi def link cssTagName Statement
522hi def link cssDeprecated Error
523hi def link cssSelectorOp Special
524hi def link cssSelectorOp2 Special
525hi def link cssAttrComma Special
526
527hi def link cssAnimationProp cssProp
528hi def link cssBackgroundProp cssProp
529hi def link cssBorderProp cssProp
530hi def link cssBoxProp cssProp
531hi def link cssColorProp cssProp
532hi def link cssContentForPagedMediaProp cssProp
533hi def link cssDimensionProp cssProp
534hi def link cssFlexibleBoxProp cssProp
535hi def link cssFontProp cssProp
536hi def link cssGeneratedContentProp cssProp
537hi def link cssGridProp cssProp
538hi def link cssHyerlinkProp cssProp
539hi def link cssLineboxProp cssProp
540hi def link cssListProp cssProp
541hi def link cssMarqueeProp cssProp
542hi def link cssMultiColumnProp cssProp
543hi def link cssPagedMediaProp cssProp
544hi def link cssPositioningProp cssProp
545hi def link cssPrintProp cssProp
546hi def link cssRubyProp cssProp
547hi def link cssSpeechProp cssProp
548hi def link cssTableProp cssProp
549hi def link cssTextProp cssProp
550hi def link cssTransformProp cssProp
551hi def link cssTransitionProp cssProp
552hi def link cssUIProp cssProp
553hi def link cssIEUIProp cssProp
554hi def link cssAuralProp cssProp
555hi def link cssRenderProp cssProp
556hi def link cssMobileTextProp cssProp
557
558hi def link cssAnimationAttr cssAttr
559hi def link cssBackgroundAttr cssAttr
560hi def link cssBorderAttr cssAttr
561hi def link cssBoxAttr cssAttr
562hi def link cssContentForPagedMediaAttr cssAttr
563hi def link cssDimensionAttr cssAttr
564hi def link cssFlexibleBoxAttr cssAttr
565hi def link cssFontAttr cssAttr
566hi def link cssGeneratedContentAttr cssAttr
567hi def link cssGridAttr cssAttr
568hi def link cssHyerlinkAttr cssAttr
569hi def link cssLineboxAttr cssAttr
570hi def link cssListAttr cssAttr
571hi def link cssMarginAttr cssAttr
572hi def link cssMarqueeAttr cssAttr
573hi def link cssMultiColumnAttr cssAttr
574hi def link cssPaddingAttr cssAttr
575hi def link cssPagedMediaAttr cssAttr
576hi def link cssPositioningAttr cssAttr
577hi def link cssGradientAttr cssAttr
578hi def link cssPrintAttr cssAttr
579hi def link cssRubyAttr cssAttr
580hi def link cssSpeechAttr cssAttr
581hi def link cssTableAttr cssAttr
582hi def link cssTextAttr cssAttr
583hi def link cssTransformAttr cssAttr
584hi def link cssTransitionAttr cssAttr
585hi def link cssUIAttr cssAttr
586hi def link cssIEUIAttr cssAttr
587hi def link cssAuralAttr cssAttr
588hi def link cssRenderAttr cssAttr
589hi def link cssCommonAttr cssAttr
590
591hi def link cssPseudoClassId PreProc
592hi def link cssPseudoClassLang Constant
593hi def link cssValueLength Number
594hi def link cssValueInteger Number
595hi def link cssValueNumber Number
596hi def link cssValueAngle Number
597hi def link cssValueTime Number
598hi def link cssValueFrequency Number
599hi def link cssFunction Constant
600hi def link cssURL String
601hi def link cssFunctionName Function
602hi def link cssFunctionComma Function
603hi def link cssColor Constant
604hi def link cssIdentifier Function
605hi def link cssInclude Include
606hi def link cssIncludeKeyword atKeyword
607hi def link cssImportant Special
608hi def link cssBraces Function
609hi def link cssBraceError Error
610hi def link cssError Error
611hi def link cssUnicodeEscape Special
612hi def link cssStringQQ String
613hi def link cssStringQ String
614hi def link cssAttributeSelector String
615hi def link cssMedia atKeyword
616hi def link cssMediaType Special
617hi def link cssMediaComma Normal
618hi def link cssMediaKeyword Statement
619hi def link cssMediaProp cssProp
620hi def link cssMediaAttr cssAttr
621hi def link cssPage atKeyword
622hi def link cssPagePseudo PreProc
623hi def link cssPageMargin atKeyword
624hi def link cssPageProp cssProp
625hi def link cssKeyFrame atKeyword
626hi def link cssKeyFrameSelector Constant
627hi def link cssFontDescriptor Special
628hi def link cssFontDescriptorFunction Constant
629hi def link cssFontDescriptorProp cssProp
630hi def link cssFontDescriptorAttr cssAttr
631hi def link cssUnicodeRange Constant
632hi def link cssClassName Function
633hi def link cssClassNameDot Function
634hi def link cssProp StorageClass
635hi def link cssAttr Constant
636hi def link cssUnitDecorators Number
637hi def link cssNoise Noise
638hi def link atKeyword PreProc
639
640let b:current_syntax = "css"
641
642if main_syntax == 'css'
643  unlet main_syntax
644endif
645
646let &cpo = s:cpo_save
647unlet s:cpo_save
648" vim: ts=8
649
650