Inexplicable space added inside the anchor!

EDIT:

Nope. Ignore this. The space is placed there by the browser.


This is the HTML snippet from my application:

Correct answers: 0 / 6<br /><br /> You have failed to pass the final test. <a href="/module/controller/course/id/5" class="accessible-link"> Click here </a> to return to the training. 

As you can see, there is one place after the closing tag. However, in the browser, space is added inside the anchor. So it looks like this:

alt text

This is the PHP code that creates the HTML:

 <?php if (isset($this->correctAnswersCount) && isset($this->answersCount)): ?> <?php echo Zend_Registry::get('translate')->_('Počet správnych odpovedí'); ?>: <?php echo ToHtml($this->correctAnswersCount); ?> / <?php echo ToHtml($this->answersCount); ?><br /><br /> <?php endif; ?> <?php echo Zend_Registry::get('translate')->_('Záverečný test sa vám nepodarilo úspešne absolvovať.'), "\n"; ?> <a href="<?php echo ToHtml($this->backToCourseUri); ?>" class="accessible-link"> <?php echo Zend_Registry::get('translate')->_('Kliknite'), "\n"; ?> </a> <?php echo Zend_Registry::get('translate')->_('pre návrat do kurzu.'), "\n"; ?> 

I am completely fined by this and cannot understand what causes this, even if I look at the code for 30 minutes.

This is the help part from the translation file:

 'Kliknite' => 'Click here', 

As you can see, there should not be a place added by Zend_Translate.

+4
source share
4 answers

Change this:

 <a href="<?php echo ToHtml($this->backToCourseUri); ?>" class="accessible-link"> <?php echo Zend_Registry::get('translate')->_('Kliknite'), "\n"; ?> </a> 

In it:

 <a href="<?php echo ToHtml($this->backToCourseUri); ?>" class="accessible-link"> <?php echo Zend_Registry::get('translate')->_('Kliknite'), "\n"; ?></a> 

</a> must be on the same line after <?php echo Zend_Registry::get('translate')->_('Kliknite'), "\n"; ?> <?php echo Zend_Registry::get('translate')->_('Kliknite'), "\n"; ?> aka Click here

EDIT:

A new line and spaces after it are displayed as 1 space, which is still inside the <a></a> tags, from where the empty space begins.

EDIT2:

For the record, I also don’t like that the closing tag will be next to the content, not the creature on the new line, but how it needs to be done to work correctly.

I like good formatted code and I am always looking for the autoformat command in my IDE.

But at least, for example, in Visual Studio, when you press Ctrl + K , Ctrl + D (cropping a formatted document), closing tags, such as </a> , are not automatically transferred to the new one for this reason: it should not breaking how it looks in front of an automatic format.

+3
source

Close the tag 'a' immediately after the following, without a new line, for example:

 <a href="/module/controller/course/id/5" class="accessible-link">Click here</a> 
+5
source

put &nbsp; right after the tag </a>

+1
source

Just wondering if you can try this?

 <a href="/module/controller/course/id/5" class="accessible-link">Click here</a> 

Not sure if this will work, but worth a try.

+1
source

All Articles