Ok, I’ve spent about 4 hours trying to figure out how to do something that can be done in simple html in about 3 seconds – use an IMAGE as an href link. This is so common in the web that I can’t believe it’s not simply an option in the HTML::a thing. I don’t see any obvious reference to it in the tutorials and this is such a basic thing that it ought to be a priority in a tutorial. What is the deal?? How do use HTML::a to accomplish " <a href=‘go’ id=‘blah’><img src=‘myimage’ ></a>". Yeah, I see all kinds of tutorials on “options” but I don’t see EXAMPLES on how to accomplish this. I looked at Zurmo, but it uses an id attribute and it’s Yii version 1 anyway.
I did try the "id" attribute and it halfway works:
<?php $options = ['class' => 'site-employer-demo', 'id' => 'emp-vid']; ?>
<?= Html::a('Employer Demo', ['site/employer_demo'], $options); ?>
The problem with this is that it only displays the top ‘sliver’ of the image. The image is 125 x 128. I’ve tried hard-coding that in the css several different ways, but nothing works.
And I’d really rather use the IMG tag for href anyway. And by the way, the very next line of my code IS a ‘non-Yii’, standard href tag as described above, and it displays just fine. But I’d rather follow the Yii2 paradigm on this if it’s not too much of a pain. Thanks