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

前端 未结 7 1754
一个人的身影
一个人的身影 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:41

    You could try adding display: block to the text and then reduce the width by using 100% minus the letter-spacing.

    .menuheader {
     text-align: right;
     display: block; 
     letter-spacing: 1.1em; 
     width: calc(100% - 1.1em);
    }

提交回复
热议问题