开发者

clickable/hoverable element on webpage

开发者 https://www.devze.com 2023-01-22 22:12 出处:网络
When the user clicks on(or moves their mouse over) my tables\' column headers, I will use JavaScript to popup a lengthier description of the data in that column.

When the user clicks on (or moves their mouse over) my tables' column headers, I will use JavaScript to popup a lengthier description of the data in that column.

However, in order to entice the user to move the mouse over (or click on) the column headers, I need to make them "look clickable". I think I've seen 开发者_StackOverflow中文版this done before using a HTML link that doesn't actually link anywhere, something like

<a href="#">Age</a>

From a semantic markup point of view this seems like a bad approach, because the element isn't actually a link, I just want to make it look like a link, so that the user knows something will happen when they click on it.

Is there a better approach?

Thanks, Don


One option is to use the CSS "cursor" property to make the cursor turn into the "hand" pointer that is typically used for links:

.myHeaderClass{
    cursor: pointer;
}

If your page applies special styling to links (e.g. a different color) you could also do the same for these headers, of course.

0

精彩评论

暂无评论...
验证码 换一张
取 消