1

我已经阅读了几个类似的问题,都涉及使用内联或类中的宽度和高度属性。但是,无论我如何尝试,它都不起作用。

由于想独立地对按钮和文本应用转换,我不得不在 div 上使用一个类,为按钮使用一个子类。剥离代码,按钮的宽度和高度没有填充周围的 div。

我正在使用 Visual Studio 2008 并针对 IE8 进行调试,如果这有什么不同的话。

HTML:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <link href="CSS/StyleSheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" >
        <tr>
            <td >
                <h1>&nbsp;TITLE</h1>
            </td>
            <td style="width:150px;height:40px;">
            <div class="button-wrapper">
            <button ID="RetrieveButton2" title="tooltip" runat="server" serverclick="RetrieveButton_Click">Search</button>
            </div>
            </td>
            <td></td>
        </tr>
        </table>
    </div>
    </form>
</body>
</html>

CSS:

body
{
}

.button-wrapper
{
    width: 150px;
    height: 40px;
}

.button-wrapper button
{
    width: 100%;
    height: 100%;   
}
4

1 回答 1

0

看来是环保的。它没有在部署时发生,但这都是学术性的,因为需求已经改变,所以不再使用这个代码。

于 2013-08-22T02:36:06.803 回答