Dzoki
Dzoki

Reputation: 739

HTML new line makes white space

I have problem with my HTML code inside the echo. This is my code:

echo "<tr><td class=\"desc\">
                            <div class=\"tit\">
                                <img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$unit_name."\" title=\"".$unit_name."\" />
                                <a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$unit_name."</a>
                            </div>
                            <div class=\"details\">
                                <img class=\"r1\" src=\"img/x.gif\" alt=\"".$lang['resources']['Lumber']."\" title=\"".$lang['resources']['Lumber']."\" />".${'bs'.$i}['wood']."|
                                <img class=\"r2\" src=\"img/x.gif\" alt=\"".$lang['resources']['Clay']."\" title=\"".$lang['resources']['Clay']."\" />".${'bs'.$i}['clay']."|
                                <img class=\"r3\" src=\"img/x.gif\" alt=\"".$lang['resources']['Iron']."\" title=\"".$lang['resources']['Iron']."\" />".${'bs'.$i}['iron']."|
                                <img class=\"r4\" src=\"img/x.gif\" alt=\"".$lang['resources']['Crop']."\" title=\"".$lang['resources']['Crop']."\" />".${'bs'.$i}['crop']."|
                                <img class=\"clock\" src=\"img/x.gif\" alt=\"".$lang['gameplay']['duration']."\" title=\"".$lang['gameplay']['duration']."\" />";

Now i have a problem that if I put those <img class things in each line, get space after | but if I put them in same line like <img class>|<img class> than no white space between them.

So actually my result looks like this:

Lumber21312| Clay21312| Iron2312| Crop2132| 

I want it look like this:

Lumber21312|Clay21312|Iron2312|Crop2132|

Sorry if I wasn't so clear :$

Upvotes: 0

Views: 391

Answers (2)

Dennis
Dennis

Reputation: 482

Echo it out like

"<img />".
"|".
"<img />".

etc. Then you can put as much whitespace in there as you want, and it won't render.

Upvotes: 1

cweiske
cweiske

Reputation: 31078

Remove the indentation space, it's causing the whitespace.

<img />|<img />|<img />|...

Upvotes: 0

Related Questions