简体   繁体   English

如何在跨度内居中一个符号文本?

[英]How to center one sign text inside span?

I have example span with text.我有带有文本的示例跨度。 Text in this case includes only one sign.在这种情况下,文本仅包含一个符号。 As you can see, text isn't centered.如您所见,文本未居中。 Second text "2B" isn't centered too.第二个文本“2B”也没有居中。 I've tried centering by:我试过通过以下方式居中:

  • display flex显示弹性
  • text-align文本对齐

在此处输入图像描述

在此处输入图像描述

html: html:

<span class="d-flex justify-content-between">1&nbsp;</span>

css: css:

border: 2px solid #f07d00;
border-radius: 20px;
position: relative;
background-color: #fff;
text-align: center;
color: #0f1c2e;
box-shadow: 0px 3px 13px #EF7F1A33;
font-size: 14px;
font-weight: 600;

padding: 3px 4px;
width: 100%;

Answer: PHP templates injected into values non breaking space after text.答案:PHP 模板在文本后注入值非中断空格。 I didn't noticed it untiled I published this post.直到我发表这篇文章,我才注意到它。 Helped only copying html code from browser and a hint @Pete (Thank you).仅帮助从浏览器复制 html 代码和提示@Pete(谢谢)。 Looking only to browser inspector, the problem is not noticeable as on this image.仅查看浏览器检查器,此图像上的问题并不明显。 在此处输入图像描述

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

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