看起来像链接的按钮

编程入门 行业动态 更新时间:2024-10-20 07:46:15
本文介绍了看起来像链接的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个要求,不允许我在页面上使用javascript.我有一些 asp:LinkBut​​tons ,但是这些似乎使用了javascript,因此我将它们替换为按钮:

Hi I have a requirement where I'm not allowed to use javascript on the page. I had some asp:LinkButtons but these appeared to use javascript so I replaced them with buttons:

<asp:Button ID="titleButton" runat="server" BorderStyle="None" CommandArgument='<%# Eval("Id") %>' OnClick="downloadButtonClick" Text="Download" CssClass="ButtonAsLink" />

使用CSS:

.ButtonAsLink { background-color:transparent; border:none; color:blue; cursor:pointer; text-decoration:underline; font-weight:bold }

这可以按我想要的方式工作,但是由于按钮边缘和文本之间的边距,按钮的文本与同一列中的标签不对齐.

This works as I was wanting but the Text of the button does not line up with the labels in the same column due to the margins between the edge of the button and the text.

我想知道是否有人可以告诉我如何将按钮文本边距设置为零?

I'm wondering if anyone can tell me how to set the button text margin to zero?

推荐答案

.ButtonAsLink{ background-color:transparent; border:none; color:blue; cursor:pointer; text-decoration:underline; font-weight:bold; padding: 0px; }

如果要删除所有填充,请将元素填充设置为0px,或者可以使用这样的属性.

Set the element padding to 0px if you want to remove all padding or you can use the attribute like this.

padding: 0px 0px 0px 0px;

当然,您可以用任何正数值代替零.与数值相关的该属性中填充的方向为:

Of course you can have any positive numerical value in place of zero. the orientation of the padding in this attribute as it relates to the numerical valuesis:

填充:右上左下

最后一点:边距是元素周围的元素和周围其他元素的间距.填充是元素内区域(例如a内的文本)的间距

Last note: Margin is the spacing around an element and other elements around it. Padding is the spacing of the area within an element (e.g. text within a )

更多推荐

看起来像链接的按钮

本文发布于:2023-11-13 00:41:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1582936.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按钮   链接

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!