简体   繁体   English

带有 CSS 或 Javascript 的字符串开头的目标编号

[英]Target number at the start of a string with CSS or Javascript

I am trying to target the size of a number at the start of a word.我试图在单词的开头定位数字的大小。

For example - I have the brand 4ever and want to resize the '4' to be the same size as the trailing text 'eva'例如 - 我有品牌 4ever 并希望将“4”的大小调整为与尾随文本“eva”的大小相同

Is there a way to do this in CSS or do I need Javascript?有没有办法在 CSS 中做到这一点,或者我需要 Javascript?

Thanks谢谢

you can try it with ::first-letter.你可以用 ::first-letter 试试。

Check docs here: https://www.w3schools.com/cssref/sel_firstletter.asp在此处查看文档: https : //www.w3schools.com/cssref/sel_firstletter.asp

p::first-letter {
  font-size: 200%;
  color: #8A2BE2;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM