看起来像链接的按钮 [英] Button which looks like link

查看:77
本文介绍了看起来像链接的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要求,不允许我在页面上使用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 )

这篇关于看起来像链接的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆