Since <span>
elements are inline
elements by default, the white space between them will be respected (displayed). One way to avoid this is to remove the undesired white space between the elements in your HTML code:
<span class='Main'><span id='id1'>some</span> <span id='id2'>words</span></span><span>.</span>
Edit
If you don't want to alter the HTML code, maybe you can use CSS to simulate spaces between words.
In the example below, I'm setting the font-size
for the container to zero to hide white space, then setting the font-size
of <span>
elements to a readable size (a method posted by thirtydot and by dsfq). Then I'm adding some margin before each <span>
that is not the first or last child.
Admittedly, this method is not very reliable, especially if you can't predict whether there will be a period or not.
.container {
font-size: 0;
}
.container span {
font-size: 16px;
background: #DDD;
}
.container span:not(:first-child):not(:last-child) {
margin: 0 0 0 .5em;
}
<div class="container">
<span>some</span>
<span>words</span>
<span>go</span>
<span>here</span>
<span>.</span>
</div>