el-input/el-select placeholder style modification

Table of contents

1. The method of placehodler style modification

2. Summary


1. The method of placehodler style modification

1. Use the pseudo class::placeholder .

.el-input__inner{
  &::placeholder{
     color:red;
  }
}

//一般需要用深度选择器才可以设置
:deep(.el-input__inner){
    &::placeholder{
        color:red;
    }
}

2. For other tags, just add the ::placeholder pseudo-class to the corresponding Dom element.

For example text-area, just add pseudo-class::placeholder to the .el-textarea__inner class

1) Results

2) Code

Note: & is sass syntax: it means to select the upper level element ;

The following code means: Add the placeholder pseudo-element on the .el-textarea__inner element and set the style of the ::placeholder pseudo-element.

  :deep(.el-textarea__inner){
    &::placeholder{
      color:green;
    }
  }

2. Summary

1. Add the ::placeholder pseudo-class to the element where the placeholder is located and set the style !

/*

Hope it helps you!

If there is any mistake, welcome to correct me, thank you very much!

*/

Guess you like

Origin blog.csdn.net/qq_45327886/article/details/126673296