html - 如何在 Visual Basic ASP.NET WEB 应用程序中向表格添加网格线

标签 html css asp.net html-table

我想在左侧显示一列问题,在右侧显示一列答案,并希望所有垂直线和水平线之间有网格线。 我打算使用 TABLE 来管理问答控件(文本和图像)。

如何在每一行和每一列之间得到一条细黑线?

这是我的应用程序的 .aspx 代码

    .auto-style4 {
        width: 800px;
    }


        <table class="auto-style4">
            <tr>
                <td class="auto-style14">What goes on the bun first?</td>
                <td class="auto-style15">cheeseburger</td>
                <td class="auto-style16">&nbsp;</td>
            </tr>

我根据下面的建议尝试了此更改,但没有成功。

        .auto-style4 {
        width: 800px;
        table, th, td { border: 1px solid black; }
    }

在添加解决方案之后,但这为所有 表添加了边框

.auto-QUESTION_TABLE 
{
    width: 800px;
      border-collapse: collapse; 
}

.auto-QUESTION_TABLE th, td
{
   border: 1px solid black;  
}        .auto-style5 {
            font-weight: normal;
        }
        .auto-style_hhmm_promise {
            width: 500px;
        }
        .auto-style7 {
            font-weight: normal;
            width: 4px;
        }
        .auto-style9 {
            font-weight: normal;
            width: 54px;
        }
        .auto-style11 {
            width: 200px;
        }
        .auto-style13 {
            width: 281px;
        }
        .auto-style14 {
            width: 433px;
        }
        .auto-style15 {
            width: 127px;
        }
        #MediaPlayer {
            width: 498px;
            height: 346px;
        }
        .auto-style16 {
            font-size: small;
        }
    h3
    {margin-top:12.0pt;
    margin-right:0in;
    margin-bottom:3.0pt;
    margin-left:0in;
    line-height:115%;
    page-break-after:avoid;
    font-size:13.0pt;
    font-family:"Cambria","serif";
    }
    </style>

...

        <table class="auto-QUESTION_TABLE">
            <tr>
                <td class="auto-style14">What goes on the bun first?</td>
                <td class="auto-style15">cheeseburger</td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14">What is this?<asp:ImageButton ID="ImageButton2" runat="server" Height="52px" ImageUrl="~/cheeseburger.jpg" Width="61px" />
                </td>
                <td class="auto-style15">crow bar</td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14" style="background-color:gray;">How do I open a frozen bun</td>
                <td class="auto-style15">
                    <asp:ImageButton ID="ImageButton4" runat="server" Height="57px" ImageUrl="~/pickles.gif" Width="79px" />
                </td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14">Which has more wisdom:&nbsp; The President or a cheeseburger</td>
                <td class="auto-style15">
                    <asp:ImageButton ID="ImageButton3" runat="server" Height="52px" ImageUrl="~/cheeseburger.jpg" Width="61px" />
                </td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14">
                    What goes on the bun first?</td>
                <td class="auto-style15">The President a</td>
                <td class="auto-style15">
                    <asp:Button ID="Button12" runat="server" Text="OK" />
                </td>
            </tr>
            <tr>
                <td class="auto-style14">
                    &nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14">&nbsp; &nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style14">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
                <td class="auto-style15">&nbsp;</td>
            </tr>
        </table>

最佳答案

.auto-style4 
{
    width: 800px;
    border-collapse: collapse;
}

.auto-style4 th, .auto-style4 td
{
    border: 1px solid black; 
}

http://jsfiddle.net/coliveira/UZ9gW/

关于html - 如何在 Visual Basic ASP.NET WEB 应用程序中向表格添加网格线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24513029/

相关文章:

javascript - 将 ViewData 值从 Controller 传递到 View

css - 将多个 Bootstrap 类合并为一个 SASS 类

javascript - 我可以使用 JavaScript 切换暗模式吗?

html - Z-index 不适用于嵌入代码

html - 是否可以创建 HTML 标签 h7、h8、h9 等?

javascript - 使用 jquery 淡化 div

jquery - 嵌套绝对元素上的 Z-index 重叠相似的绝对元素?

c# - ASP.NET 路由和 CMS

asp.net - 我应该忽略偶尔出现的无效 View 状态错误吗?

html - 将 CSS 样式应用于 asp 内容