Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7544973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:48:39+00:00 2026-05-30T08:48:39+00:00

I am using haml to display the user’s name and nickname (in a single

  • 0

I am using haml to display the user’s name and nickname (in a single line format) as seen below

//haml code
%div.name
  <%= user.name %> /
  %a.nickname{:href => '#!/<%= user.nickname %>'} <%= user.nickname %>

How it looks like on the web

enter image description here

How can I make the entire line above clickable on the web but at the same time retain the colors of the text? (i.e. “Some Username” text can be linked like “nickname” but retain it’s color grey)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:48:40+00:00Added an answer on May 30, 2026 at 8:48 am

    This is a little old and the code posted seems a bit weird, but I’m going to just post a Haml snippet and answer it relative to my snippet both with and without rails helpers

    .name
      = link_to user.name, "#!/#{user.name}", :class => 'username' 
      /
      = link_to user.nickname, "#!/#{user.nickname}", :class => 'nickname'
    

    or without

    .name
      %a.username{:href => "#!/#{user.name}"}
        = user.name
      /
      %a.nickname{:href => "#!/#{user.nickname}"}
        = user.nickname
    

    if you’re using Sass include this or some subset of these rules to turn off hoverable underlining also replace #999 with whatever color you’re using for the regular text. If you want different behavior for each break them out into separate sets of rules

    Same behavior for both pieces of the name

    .name
      .username, .nickname
        a:link, a:visited, a:hover, a:active, a:focus
          :color #AAA      
          :text-decoration none
    

    Or specify different behavior for each

    .name
      .username
        a:link, a:visited, a:hover, a:active, a:focus
          :color #AAA      
          :text-decoration none
      .nickname
        a:link, a:visited, a:hover, a:active, a:focus
          :color #00A      
          :text-decoration underline
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a tab-pane using HAML as shown in my code snippet below
I'm using Haml from the command-line to do a basic transform of one .haml
I am using HAML to create a drop down list as shown below: %select.categories
So I'm working on some HTML5 code using HAML and SASS. I currently have
If you are using HAML and SASS in your Rails application, then any templates
I'm using HAML to generate some static html pages for a site, and I
I am using haml with my rails application and i have a question how
I am trying to build a simple nested html menu using HAML and am
If using HAML on Ruby on Rails, then :sass #someDiv border: 3px dashed orange
I am using haml in ruby on rails and editing it in text mate.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.