简体   繁体   中英

How to remove first and last space from text node using Safari?

I just found a problem when viewing a page using Safari. Normally, when I have code like:

<a href="someplace.html">
    Someplace
</a>

I expect the browser to render the text as a link with no extra content. That's what Chrome and Firefox do. When using Safari though, that's not the case. Safari adds one space before and one after the text, like the following

标签示例 .

I know Chrome adds space to the inspector too, but that's not the problem. The problem is that Safari actually renders the whitespace, which is a problem if your content breaks into multiple lines,

像这样 .

Is there a way to prevent this from happening or should I modify my code and put everything in a single line in order to avoid this problem?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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