How does YouCompleteMe automatically complete css and attribute values?

  question, vim

After YCM was installed, no other configuration was added to. vimrc.
JavaScript can be completed automatically now (for example, if you enter Obj, a popup will automatically appear to let you select the required completion), but css needs to be completed by omnicomplete according to [c-x] [c-o]. how can css files be completed automatically like JavaScript?

Put this code in your. vimrc and change the number 4 to your indent setting.

let g:ycm_semantic_triggers = {
 \   'css': [ 're!  ^\s{4}', 're!  :\s+' ],
 \ }

Reference link:YCM will not use omnicompletion results in .css files · Issue #413 · Valloric/YouCompleteMe