Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make this link tag in HAML?

How can I do something like this in HAML (within Rails app such that it matters)?

<li><a href="#" title="Meet the Team"><strong>Team <em>16 members</em></strong></a></li>

Edit: how also to do it with link_to and a route of pages_team?

like image 835
Meltemi Avatar asked Apr 30 '11 01:04

Meltemi


People also ask

How do you add a link in the middle of a paragraph in HTML?

To make a hyperlink in an HTML page, use the <a> and </a> tags, which are the tags used to define the links. The <a> tag indicates where the hyperlink starts and the </a> tag indicates where it ends. Whatever text gets added inside these tags, will work as a hyperlink.

What is Haml in css?

What is it? Haml (HTML abstraction markup language) is based on one primary principle: markup should be beautiful. It's not just beauty for beauty's sake either; Haml accelerates and simplifies template creation down to veritable haiku.


2 Answers

The basic method would look like this ...

%li
  %a{ :href => "#", :title => "Meet the Team" }
    %strong
      Team
      %em 16 members

Or using the new hash syntax ...

%li
  %a{ href: "#", title: "Meet the Team" }
    %strong
      Team
      %em 16 members
like image 172
radixhound Avatar answered Sep 19 '22 12:09

radixhound


%li= link_to raw('<strong>Team <em>16 members</em></strong>'), pages_team, :title => 'Meet the Team'

or

%li= link_to content_tag(:strong, raw("Team #{content_tag(:em, '16 members)}")), pages_team, :title => 'Meet the Team 
like image 32
Unixmonkey Avatar answered Sep 20 '22 12:09

Unixmonkey