문제

I have a problem, but maybe this is not a problem actually! Why below HTML markup is generating a result which seems to be incorrect even using Standard Fonts like Arial?

<span>سلام</span><span>خداحافظ</span>

سلامخداحافظ

Above output shouldn't be this? (ignore space used for simulation)

سلام خداحافظ

Also i have used margin for a tag but same problem. Thanks in advance ;)

도움이 되었습니까?

해결책

HTML elements do not necessarily break words. There are many legitimate reasons for that.

For instance, you might want to put emphasis on a letter in medial form by wrapping it in a <strong> or <em> element. If that element was considered as a single word, the letter would switch to its isolated form, which would probably not be the effect you're looking for.

Inserting either a non-breaking space (&nbsp;) or a zero-width non-breaking space (&#8203;) between the <span> elements fixes your problem.

You can see the results in this fiddle.

다른 팁

As i know span tag doesnt have href. I assume that u mean a tag.

u can use a space character between a tags to get desired result:

<a href="#">سلام</a>&nbsp;<a href="#">خداحافظ</a>

You can also enter an space between the to tags like. there is no need to use html codes:

<a href="#">سلام</a> <a href="#">خداحافظ</a>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top