user2232273 user2232273 - 1 year ago 93
ASP.NET (C#) Question

CSS - Style the title from the image tag

I'm trying to style the title from the image tag.

I have search other question but can´t it put working in my project.

But I can´t make any changes.

Someone can give me hand with this pls?

my code:

table.tablesorter tbody tr td a:hover img[title]:after
content: attr(title);
padding: 4px 8px;
color: #FFF;

<table class="tablesorter" style="width:98% !important">

<a href="@Url.Action("Edit","Account", new { id=item.UserId })">
<img src="~/Content/images/icon_edit.png" title="Edit"/>


Answer Source

It should be content: attr(title);, not content: attr(data-title); - you don't have a data attribute.

Also, it seems ::before and ::after pseudo-elements are not defined for img - you may have to use something else:
CSS Content attribute for IMG tag

Working Example (when the image is missing):
Another example, with the title on the <a> tag:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download