Change last letter color

后端 未结 8 1551
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 16:42

Example code:

string

I want to change the color on the last letter, in this case \"g\", but I need soluti

8条回答
  •  隐瞒了意图╮
    2020-11-27 17:03

    It could be achieved using only CSS and an ::after pseudo-element without any changes in HTML:

    .test {
      font-size: 16pt;
      position: relative;
    }
    .test::after {
      bottom: 0;
      color: red;
      content: 'g';
      position: absolute;
      transform: translate(-100%, 0);
    }

    string

提交回复
热议问题