Welcome Guest, Not a member yet? Register   Sign In
How do I get a span *inside* an anchor using CI anchor ?
#1

[eluser]vincej[/eluser]
Hi - I am trying to use a particular CSS technique and the tutorial requires that you place a span inside an <a> anchor - easy when using HTML, but not so obvious when using CI. Example:

Code:
<ul>
   <li><a href="#">Buy Widgets <span></span></a></li>
   <li><a href="#">About Widget Corp <span></span></a></li>
   <li><a href="#">Contact Us <span></span></a></li>
  
</ul>

when I attempt to do it with CI the span falls either outside the anchor or if you follow the user guide placing the span inside the CI anchor,like this

Code:
echo anchor("welcome/cat/$topkey", $toplist['name'],"<span></span>");

then the span shows up in front of the label and one of the chevrons shows up on the page.

I have tried various combinations of double and single quotes.

Many Many thanks for any advice !
#2

[eluser]CroNiX[/eluser]
Why are you putting it in the 3rd parameter (the attributes) of anchor()? Just append it to the 2nd parameter, which is the text of the link.
Code:
echo anchor("welcome/cat/$topkey", $toplist['name'] . '<span></span>');
#3

[eluser]vincej[/eluser]
Thanks CroxNix - the obvious defeats me again ! It worked great !




Theme © iAndrew 2016 - Forum software by © MyBB