Asp.net ASP按钮对于不同的浏览器看起来不同
我在RadFileUpload控件附近放置了一个asp按钮。我已经尝试了很多方法来设置合适的外观,例如内联css、外部css,但仍然没有设置。 我的.aspx页面代码如下Asp.net ASP按钮对于不同的浏览器看起来不同,asp.net,css,cross-browser,Asp.net,Css,Cross Browser,我在RadFileUpload控件附近放置了一个asp按钮。我已经尝试了很多方法来设置合适的外观,例如内联css、外部css,但仍然没有设置。 我的.aspx页面代码如下 <tr> <td class="formlabel2"> <asp:Label ID="lblLName17" runat="server" Text="Photo:"></asp:Label> </td> <td val
<tr>
<td class="formlabel2">
<asp:Label ID="lblLName17" runat="server" Text="Photo:"></asp:Label>
</td>
<td valign="top" style="padding: 0px !important">
<table width="275px" style="padding: 0px !important">
<tr style="padding: 0px !important">
<td width="200px" style="padding: 0px !important">
<telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" AutoAddFileInputs="false"
OnClientFilesUploaded="HideRemoveBtn" Visible="true" OnClientFileUploadRemoved="ResizeTextBox"
MaxFileInputsCount="1" MultipleFileSelection="Disabled" TabIndex="17" OnFileUploaded="RadAsyncUpload1_FileUploaded"
Height="25px">
</telerik:RadAsyncUpload>
</td>
<td width="65px" valign="top" style="padding: -4px !important; vertical-align:top;">
<asp:Button Width="65px" ID="btnRomovePhoto" Visible="true" Text="Remove" runat="server" style="margin-top:0px"
OnClick="btnRomovePhoto_Click"></asp:Button>
</td>
</tr>
</table>
</td>
</tr>
使用cssClass=“btnRomovePhoto”,但在Mozilla和IE9中,此按钮看起来很大,而在chrome和safari中,此按钮看起来比上载控件的高度小。如果我设置了高度,那么在Mozila和IE中,即使我设置了文本对齐和垂直对齐,文本也会显示在底部。我试过用INPUT[Type=button]设置css,也试过用Html按钮,但同样的问题也发生了
任何解决方案?使用CSS3框大小属性将填充和边框包含在总宽度中。它修复了Firefox和IE的填充问题
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
更新:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="box_sizing._default" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<style type="text/css">
/*********** CSS Reset Start *************************/
/**** Add this to the beginning of your CSS file *****/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
input[type="submit"]
{
margin: 0;
padding: 0;
border: 0;
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
}
/*********** CSS Reset End ***************************/
/*****************************************************/
.btnRemovePhoto,
#btnRemovePhoto
{
height:40px;
margin:20px 0 0 20px;
border:1px solid #ff7373;
padding:0 20px;
font-family: sans-serif;
font-size: 12px;
color:#ff7373;
line-height: 1;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnRemovePhoto" CssClass="btnRemovePhoto" runat="server" Text="Remove" ClientIDMode="Static" />
</div>
</form>
</body>
</html>
/***********CSS重置开始*************************/
/****将其添加到CSS文件的开头*****/
html、正文、div、span、小程序、对象、iframe、,
h1,h2,h3,h4,h5,h6,区块报价,预,
a、 缩写,首字母缩写,地址,大,引用,代码,
del、dfn、em、img、ins、kbd、q、s、samp、,
小、走向、强、次、辅助、tt、var、,
b、 u,i,中心,
dl,dt,dd,ol,ul,li,
字段集、表单、标签、图例、,
表格、标题、正文、tfoot、THAD、tr、th、td、,
文章、旁白、画布、细节、嵌入、,
图,figcaption,页脚,页眉,H组,
菜单、导航、输出、ruby、节、摘要、,
时间、标记、音频、视频{
保证金:0;
填充:0;
边界:0;
}
输入[type=“submit”]
{
保证金:0;
填充:0;
边界:0;
框大小:边框框;
-webkit框大小:边框框;
-moz框大小:边框框;
}
/***********CSS重置结束***************************/
/*****************************************************/
.btnRemovePhoto,
#btnRemovePhoto
{
高度:40px;
利润率:20px 0 0 20px;
边框:1px实心#ff7373;
填充:0 20px;
字体系列:无衬线;
字体大小:12px;
颜色:#ff7373;
线高:1;
}
是否使用了线条高度
行高:代码>对不起,这是我的错误。。Mozilla和Chrome…我想写Chrome而不是Firefox。首先要检查的是:浏览器是否在怪癖模式下运行。特别是对于IE,这会产生很大的差异,并会导致同一代码的浏览器特定差异。离题:所有这些!重要信息
标志是一个问题。过度使用!重要提示
是不好的,因为如果需要,很难覆盖它,但它也是其他地方可能存在的糟糕代码的指标,因为如果需要使用!重要信息
很多时候,这意味着您已经很难让CSS覆盖正常工作。这些迹象表明你的CSS可能需要一些整理工作。我试过了。但它不起作用。当我设置按钮的高度文本时,它会显示在底部。我试过了。不要影响任何人。我在使用firebug进行查看时指出,在Mozilla中应用的css没有任何效果
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="default.aspx.cs" Inherits="box_sizing._default" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<style type="text/css">
/*********** CSS Reset Start *************************/
/**** Add this to the beginning of your CSS file *****/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
input[type="submit"]
{
margin: 0;
padding: 0;
border: 0;
box-sizing: border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing: border-box;
}
/*********** CSS Reset End ***************************/
/*****************************************************/
.btnRemovePhoto,
#btnRemovePhoto
{
height:40px;
margin:20px 0 0 20px;
border:1px solid #ff7373;
padding:0 20px;
font-family: sans-serif;
font-size: 12px;
color:#ff7373;
line-height: 1;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnRemovePhoto" CssClass="btnRemovePhoto" runat="server" Text="Remove" ClientIDMode="Static" />
</div>
</form>
</body>
</html>