2

I'm using the <table> tag to format some text into rows and columns, but I don't want the rows to alternate colors. For some reason this is happening automatically and I don't know how to turn it off.

Here is my HTML:

<table class="homepage" summary "list of dplans">
<div class="options">
    <ul>
        <% @dplans.each do |dplan| %>
        <tr class ='' "list">
            <td class="button"><%='' link_to dplan.name, dplan %></td>
            <td class="button">
                <%='' link_to "edit name", edit_dplan_path(dplan )%>
            </td>
            <td class="button"><%='' link_to "delete", '#'%></td>
        </tr>
        <% end %>
    </ul>
</div>
</table>

And here is my css:

 td.button {
  font-size: 16px;
  list-style: none;
}
1
  • A screenshot would be great. Try background-color: transparent; in your td selector. Aug 17, 2011 at 20:32

2 Answers 2

1

I don't think the tag has any styling by default, so chances are there's some other CSS that's causing this. The best way to figure this out is to look at a developer tool like firebug, which can tell you exactly where that background-color is set.

If you just want to override it, you can try something like:

td {
    background:none;
}
1
  • 1
    @steffi2392 What didn't work? Inspecting the elements in Firebug?
    – robertc
    Nov 17, 2011 at 15:14
0

First of all, you nested a <div> tag as a child to a <table>. Which is wrong. The only tags permitted for this are <tr>,<th>,<tbody>, etc...

 <table class="homepage" summary "List of dplans">
                    <% @dplans.each do |dplan| %>
                     <tr class = "list">
                      <td class="button"><%= link_to dplan.name, dplan %></td>
                      <td class="button"><%= link_to "Edit name", edit_dplan_path(dplan )%></td>
                      <td class="button"><%= link_to "Delete", '#'%></td> 
                     </tr> 
                    <% end %>
</table>

See if this helps

2
  • Thanks for the tip - I'm bad at formatting - but it didn't make any difference. Still alternating colors.
    – steffi2392
    Aug 18, 2011 at 4:20
  • 1
    Than Chazbot's comment would be relevant Aug 18, 2011 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.