How can I remove letter-spacing for the last letter of an element in CSS?

前端 未结 7 1739
一个人的身影
一个人的身影 2020-12-14 15:10

Here\'s the image in question of my HTML page. The text menu is inside a right aligned div, and has 1.2em letter spacing. Is there a pseudo-selector for this? I would not li

相关标签:
7条回答
  • 2020-12-14 15:42

    You can add an :after of your element and set a minus margin left equal as the letter-spacing

    .menuheader {
      letter-spacing: 1.1em;
    }
        
    .menuheader:after {
       content:" ";
       margin-left:  -1.1em;
    }
    

    Tested on Chrome, Firefox and Edge

    0 讨论(0)
提交回复
热议问题