Topic: ugly effect in dynamic Menu (background-color of current page is too

Hello everyone,

I am pretty new to the Railsworld but making some real motivating successes.


The first real time-consuming  problem I have is getting a dynamic Menu working (highlightning of the active Page Button)

I got this ugly effect: http://maseinet.de/files/screen.png
screenshot


the highlighted background-color is smaller than the button.

This is the code - maybe the problem is the "span" tag
Does someone know a simple alternative than the "link_to_unless_current"-way
or a way to fix this?

<ul class="navigation">
<li><%= link_to_unless_current("Link1", "http://domain.de:3000/categories/1/posts") {|link|
"<span class=\"current\">#{link}</span>"}%></li>
<li><%= link_to_unless_current("Link2", "http://domain.de:3000/categories/2/posts") {|link|
"<span class=\"current\">#{link}</span>"}%></li>
<li><%= link_to_unless_current("Link3", "http://domain.de:3000/categories/3/posts") {|link|
"<span class=\"current\">#{link}</span>"}%></li>
<li><%= link_to_unless_current("Link4", "http://domain.de:3000/categories/4/posts") {|link|
"<span class=\"current\">#{link}</span>"}%></li>
  </ul>

 .navigation li{
display: inline;
padding:5px 0;
width: 100px;
background-color:#485e49;
color:#eee;
float:left;
text-align:center;
border-left:1px solid #fff;

.navigation .current{
  text-decoration: underline;
margin-left:0px;
text-align:center;
background:red;
color:#eee;
padding:5px 0;


Best Regards!
Marc

Last edited by masei (2009-08-06 06:17:10)

Re: ugly effect in dynamic Menu (background-color of current page is too

O.K. - after a long time of seeking - solved the problem myself :-)

display: block;
width: 100px;
height: 8px;

works fine

the solution with link_unless_current was very important, because I have some difficult routes and  link_unless_current is the only current-page-finder that worked in this case.

best regards

marc