Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hand emoji πŸ‘‰HereπŸ‘ˆ has extra space, how can I solve this with CSS elegantly?

Tags:

html

css

emoji

enter image description here

p {
  font-size: 16px;
}
<p>
  <span>πŸ‘‰</span>
  <span>Here</span>
  <span>πŸ‘ˆ</span>
</p>

As you can see, the left emoji hand has extra empty space.

Currently, I add padding-left: 0; padding-right: 5px; to the center string.

But is there any other way or CSS property that can solve this?

enter image description here

My Browser is Chrome 80, there is actually a little extra space.

Although one line will remove space, but the problem still stands:

enter image description here

Using Pseudo class is not helping either, notice that there is still not line up

enter image description here

like image 641
Joseph Wang Avatar asked Oct 30 '25 04:10

Joseph Wang


2 Answers

I did a lot of cheating but this seems to work

p {
  font-size: 16px;
  letter-spacing: -6px;
}
.letters{
  letter-spacing: 0.01em;
  padding-left: 0.35em;
}
<p>
  πŸ‘‰
  <span class="letters">Here</span>
  πŸ‘ˆ
</p>
like image 117
Brady Ward Avatar answered Nov 01 '25 18:11

Brady Ward


The emojis are really just decoration, not content. Use psuedo elements and the problem is solved.

p {
  font-size: 16px;
}

p > span::before{
  content: 'πŸ‘‰';
}

p > span::after{
  content: 'πŸ‘ˆ';
}
<p>
  <span>Here</span>
</p>
like image 31
Jon P Avatar answered Nov 01 '25 19:11

Jon P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!