How to <%= link_to %> entire area of
  • in Ruby on Rails

  • Tags: ruby-on-rails,css

    Problem :

    In my Navbar, I'm currently linking the phrase "Sign out" to signout_path:

        <li><%= link_to "Sign out", signout_path, :method => :delete %></li>

    How can I make the entire area of the li tag become a link so that when I click anywhere in the area of the gradient, it links to home?

    CSS for li area when hovered over:

         ul.TabNav li:hover {

    Thanks! :)

    Solution :

    Try this in your CSS:

    ul.TabNav li a {
      display: block;

    If this doesn't break your layout, it should make the link fill up the available space in the li tag, making all of it clickable.

      CSS Howto..

      How to make child divs visible in's CSS Radio Checked Tab Method

      How to dynamically change CSS elements to be HTTPS or HTTP

      How to properly position DIVS on a page to

      How can i enlarge wesite font-size when used with vw unit for WCAG (accessibility) propeses?

      how to create multiple instance of a css class?

      How to pass the output of CSS Selector to beautiful soup?

      ASP.NET - how to retrieve CSS styles applied by javascript on page postback?

      HTML/CSS: How to move my navigation bar to the middle?

      CSS - How to make
      side by side not wrap when user make browser size changing?

      Why jQuery.css does not apply a property if it is not supported and how is this being checked?

      How to switch visibility of an HTML div in css for overlaying

      How do I select this Div with CSS

      How to change CSS of an element on hide/show of another element(without custom events)?

      How do I format text to wrap onto a second line using bootstrap?

      How to change image css after rotating it in JS?

      How to extend the border-top on my nav_bar class

      How to refer to a CSS style using ASP.NET MVC?

      Rails: Stylesheet/view issue? Nothing is showing on the screen although there is source code when viewed in browser

      How can I exclude certain elements from css property that has been applied to their parent without using the style attribute

      How to use weather API to create my weather HTML page [closed]

      How to have dots as horizontal separator with inline text like in this screenshot?

      How do i center an HTML DIV with logo on the left?

      How to format CSS of a dropdown menu so if the 'parent' dropdown is current then the children will not take the formatting of the parent

      How to automatically style HTML output of kramdown converter?

      How to access regular CSS from GWT widget?

      How to overide all css style classes in an input field without effecting other elements?

      How to change Image inside of CSS of a usercontrol

      How to detect if html contains block level elements using jQuery?

      Space between list, space on left side of the ul. How to remove this?

      How to align an image inside a DIV without adding new classes using CSS