Reputation: 269
Right now I am attempting to prevent a text button from underlining itself. This button is located in a table which is why I have a <td>
tag. However when apply internal style to rid of the underlining, it remains underlined. How can I get rid of this, or am I incorrectly getting rid of this. I learned how to disable the underline from here: http://www.pageresource.com/html/link3.htm But like I said before, it failed.
<td style="text-decoration:none"><a href="view_topic.php?id=<?php echo $rows['id']; ?>"><?php echo $rows['subject']; ?> </a><BR></td>
Upvotes: 2
Views: 132
Reputation: 6981
You should add a class to your <a>
element such as .a-no-underline
and then in your CSS file, you can add a style rule such as:
.a-no-underline {
text-decoration: none !important;
}
Make sure that you apply this class to the <a>
element and not the <td>
element. Like so:
<td>
<a class="a-no-underline" href="view_topic.php?id=<?php echo $rows['id']; ?>">
<?php echo $rows['subject']; ?>
</a><br/>
</td>
Upvotes: 0
Reputation: 1
Move the style from the td tag to the anchor tag.
<td><a href="view_topic.php?id=<?php echo $rows['id']; ?>" style="text-decoration:none"><?php echo $rows['subject']; ?> </a><BR></td>
Upvotes: 0
Reputation: 788
just change your code to
<td><a style="text-decoration:none !important;" href="view_topic.php?id=<?php echo $rows['id']; ?>"><?php echo $rows['subject']; ?> </a><BR></td>
Upvotes: 0
Reputation: 41539
If you absolutely must have your styles inline, then in this case you need the text-decoration:none
applied in the style attribute of the anchor, rather then the table cell:
<a style="text-decoration:none" href="view_topic.php?id=<?php...
Doing it this way though, you have to apply it to every element, rather than using a css class to apply it to all links at once.
Upvotes: 2
Reputation: 10182
You need to apply the text-decoration to the a
element, not the table cell.
<td>
<a style="text-decoration:none" href="view_topic.php?id=<?php echo $rows['id']; ?>">
<?php echo $rows['subject']; ?>
</a><BR>
</td>
Here is a fiddle showing the difference between the two: http://jsfiddle.net/LsFK5/
Upvotes: 1
Reputation: 5144
The problem is that you've placed the text-decoration styling on the td
instead of the a
Upvotes: 1