修改 CSS 文件以适合我的 asp.net 页面

发布于 2024-12-01 01:22:10 字数 7267 浏览 2 评论 0 原文

当我搜索如何在不使用图像的情况下创建选项卡时,我发现了一个 CSS 文件。我遇到了 CSS Tabs 2.0

它满足了我的目的。
但是,现在我需要自定义它以适合我的 asp.net 页面,但我似乎无法到达任何地方。
CSS 文件使用
我正在使用带有

这是示例代码:

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

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CSS Tabs | unraveled</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<!-- CSS Tabs is licensed under Creative Commons Attribution 3.0 - http://creativecommons.org/licenses/by/3.0/ -->

<style type="text/css">

/* begin css tabs */

ul#tabnav { /* general settings */
text-align: left; /* set to left, right or center */
margin: 1em 0 1em 0; /* set margins as desired */
font: bold 11px verdana, arial, sans-serif; /* set font as desired */
border-bottom: 1px solid #6c6; /* set border COLOR as desired */
list-style-type: none;
padding: 3px 10px 3px 10px; /* THIRD number must change with respect to padding-top (X) below */
}

ul#tabnav li { /* do not change */
display: inline;
}

body#tab1 li.tab1, body#tab2 li.tab2, body#tab3 li.tab3, body#tab4 li.tab4 { /* settings for selected tab */
border-bottom: 1px solid #fff; /* set border color to page background color */
background-color: #fff; /* set background color to match above border color */
}

body#tab1 li.tab1 a, body#tab2 li.tab2 a, body#tab3 li.tab3 a, body#tab4 li.tab4 a { /* settings for selected tab link */
background-color: #fff; /* set selected tab background color as desired */
color: #000; /* set selected tab link color as desired */
position: relative;
top: 1px;
padding-top: 4px; /* must change with respect to padding (X) above and below */
}

ul#tabnav li a { /* settings for all tab links */
padding: 3px 4px; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */
border: 1px solid #6c6; /* set border COLOR as desired; usually matches border color specified in #tabnav */
background-color: #cfc; /* set unselected tab background color as desired */
color: #666; /* set unselected tab link color as desired */
margin-right: 0px; /* set additional spacing between tabs as desired */
text-decoration: none;
border-bottom: none;
}

ul#tabnav a:hover { /* settings for hover effect */
background: #fff; /* set desired hover color */
}

/* end css tabs */

</style>
</head>

<body id="tab1">

<p><a href="/publications/css_tabs/">&#8592; Introduction</a></p>

<h1>CSS Tabs 2.0</h1>

<ul id="tabnav">
    <li class="tab1"><a href="index.html">Tab One</a></li>
    <li class="tab2"><a href="index2.html">Tab Two</a></li>
    <li class="tab3"><a href="index3.html">Tab Three</a></li>
    <li class="tab4"><a href="index4.html">Tab Four</a></li>

</ul>

<p>CSS Tabs is licensed under <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a>.</p>

<p>Joshua Kaufman, <a href="/">unraveled</a><br />
28 January, 2007</p>

<a href="css_tabs_v1.html">Looking for CSS Tabs 1.0?</a>
</body>
</html>

这是我的代码:

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

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/css">

/* begin css tabs */

ul#tabnav { /* general settings */
text-align: left; /* set to left, right or center */
margin: 1em 0 1em 0; /* set margins as desired */
font: bold 11px verdana, arial, sans-serif; /* set font as desired */
border-bottom: 1px solid #6c6; /* set border COLOR as desired */
list-style-type: none;
padding: 3px 10px 3px 10px; /* THIRD number must change with respect to padding-top (X) below */
}

ul#tabnav li { /* do not change */
display: inline;
}

body#tab1 li.tab1, body#tab2 li.tab2, body#tab3 li.tab3, body#tab4 li.tab4 { /* settings for selected tab */
border-bottom: 1px solid #fff; /* set border color to page background color */
background-color: #cc6666; /* set background color to match above border color */
}

body#tab1 li.tab1 a, body#tab2 li.tab2 a, body#tab3 li.tab3 a, body#tab4 li.tab4 a { /* settings for selected tab link */
background-color: #fff; /* set selected tab background color as desired */
color: #000; /* set selected tab link color as desired */
position: relative;
top: 1px;
padding-top: 4px; /* must change with respect to padding (X) above and below */
}

ul#tabnav li a { /* settings for all tab links */
padding: 3px 4px; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */
border: 1px solid #6c6; /* set border COLOR as desired; usually matches border color specified in #tabnav */
background-color: #ffffff; /* set unselected tab background color as desired */
color: #666; /* set unselected tab link color as desired */
margin-right: 0px; /* set additional spacing between tabs as desired */
text-decoration: none;
border-bottom: none;
}

ul#tabnav a:hover { /* settings for hover effect */
background: #cc6600; /* set desired hover color */
}

/* end css tabs */

</style>
</head>


            <table cellspacing="0" cellpadding="0" border="0" ID="Table1">
                <tr>
                    <td width="15"></td>
                    <td valign="bottom">
                        <%--Generate Home Tab--%>
                        <table cellspacing="0" cellpadding="10" border="0" ID="Table0">
                            <tr>
                                <td></td>
                                <td><div align="center" class="tab1"><a href="index.aspx">Home</a></div></td>
                                <td></td>
                            </tr>
                        </table>
                    </td>
                    <td width="3"></td>
                    <td>
                        <%--Generate CRM Tab--%>
                        <table cellspacing="0" cellpadding="0" border="0" ID="Table1">
                            <tr>
                                <td></td>
                                <td><div align="center" id="Contact"><a href="Contact.aspx" class="Tab2" id="tabnav" title="Contact">Contact</a></div></td>
                                <td></td>
                            </tr>
                        </table>
                    </td>
        </tr>
    </table>  

我将不胜感激的 表格任何人都可以帮助使选项卡在我的代码中工作。

I found a CSS file while I was searching for how to create tabs without using images. I came across CSS Tabs 2.0

which serves my purpose.
However, now I need to customize it to fit my asp.net page, and I can't seem to be able to get anywhere.
The CSS file uses a <ul and an <li
I am using a Table with <tr> and <td>

This is the sample code:

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

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CSS Tabs | unraveled</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<!-- CSS Tabs is licensed under Creative Commons Attribution 3.0 - http://creativecommons.org/licenses/by/3.0/ -->

<style type="text/css">

/* begin css tabs */

ul#tabnav { /* general settings */
text-align: left; /* set to left, right or center */
margin: 1em 0 1em 0; /* set margins as desired */
font: bold 11px verdana, arial, sans-serif; /* set font as desired */
border-bottom: 1px solid #6c6; /* set border COLOR as desired */
list-style-type: none;
padding: 3px 10px 3px 10px; /* THIRD number must change with respect to padding-top (X) below */
}

ul#tabnav li { /* do not change */
display: inline;
}

body#tab1 li.tab1, body#tab2 li.tab2, body#tab3 li.tab3, body#tab4 li.tab4 { /* settings for selected tab */
border-bottom: 1px solid #fff; /* set border color to page background color */
background-color: #fff; /* set background color to match above border color */
}

body#tab1 li.tab1 a, body#tab2 li.tab2 a, body#tab3 li.tab3 a, body#tab4 li.tab4 a { /* settings for selected tab link */
background-color: #fff; /* set selected tab background color as desired */
color: #000; /* set selected tab link color as desired */
position: relative;
top: 1px;
padding-top: 4px; /* must change with respect to padding (X) above and below */
}

ul#tabnav li a { /* settings for all tab links */
padding: 3px 4px; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */
border: 1px solid #6c6; /* set border COLOR as desired; usually matches border color specified in #tabnav */
background-color: #cfc; /* set unselected tab background color as desired */
color: #666; /* set unselected tab link color as desired */
margin-right: 0px; /* set additional spacing between tabs as desired */
text-decoration: none;
border-bottom: none;
}

ul#tabnav a:hover { /* settings for hover effect */
background: #fff; /* set desired hover color */
}

/* end css tabs */

</style>
</head>

<body id="tab1">

<p><a href="/publications/css_tabs/">← Introduction</a></p>

<h1>CSS Tabs 2.0</h1>

<ul id="tabnav">
    <li class="tab1"><a href="index.html">Tab One</a></li>
    <li class="tab2"><a href="index2.html">Tab Two</a></li>
    <li class="tab3"><a href="index3.html">Tab Three</a></li>
    <li class="tab4"><a href="index4.html">Tab Four</a></li>

</ul>

<p>CSS Tabs is licensed under <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a>.</p>

<p>Joshua Kaufman, <a href="/">unraveled</a><br />
28 January, 2007</p>

<a href="css_tabs_v1.html">Looking for CSS Tabs 1.0?</a>
</body>
</html>

This is my code:

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

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<style type="text/css">

/* begin css tabs */

ul#tabnav { /* general settings */
text-align: left; /* set to left, right or center */
margin: 1em 0 1em 0; /* set margins as desired */
font: bold 11px verdana, arial, sans-serif; /* set font as desired */
border-bottom: 1px solid #6c6; /* set border COLOR as desired */
list-style-type: none;
padding: 3px 10px 3px 10px; /* THIRD number must change with respect to padding-top (X) below */
}

ul#tabnav li { /* do not change */
display: inline;
}

body#tab1 li.tab1, body#tab2 li.tab2, body#tab3 li.tab3, body#tab4 li.tab4 { /* settings for selected tab */
border-bottom: 1px solid #fff; /* set border color to page background color */
background-color: #cc6666; /* set background color to match above border color */
}

body#tab1 li.tab1 a, body#tab2 li.tab2 a, body#tab3 li.tab3 a, body#tab4 li.tab4 a { /* settings for selected tab link */
background-color: #fff; /* set selected tab background color as desired */
color: #000; /* set selected tab link color as desired */
position: relative;
top: 1px;
padding-top: 4px; /* must change with respect to padding (X) above and below */
}

ul#tabnav li a { /* settings for all tab links */
padding: 3px 4px; /* set padding (tab size) as desired; FIRST number must change with respect to padding-top (X) above */
border: 1px solid #6c6; /* set border COLOR as desired; usually matches border color specified in #tabnav */
background-color: #ffffff; /* set unselected tab background color as desired */
color: #666; /* set unselected tab link color as desired */
margin-right: 0px; /* set additional spacing between tabs as desired */
text-decoration: none;
border-bottom: none;
}

ul#tabnav a:hover { /* settings for hover effect */
background: #cc6600; /* set desired hover color */
}

/* end css tabs */

</style>
</head>


            <table cellspacing="0" cellpadding="0" border="0" ID="Table1">
                <tr>
                    <td width="15"></td>
                    <td valign="bottom">
                        <%--Generate Home Tab--%>
                        <table cellspacing="0" cellpadding="10" border="0" ID="Table0">
                            <tr>
                                <td></td>
                                <td><div align="center" class="tab1"><a href="index.aspx">Home</a></div></td>
                                <td></td>
                            </tr>
                        </table>
                    </td>
                    <td width="3"></td>
                    <td>
                        <%--Generate CRM Tab--%>
                        <table cellspacing="0" cellpadding="0" border="0" ID="Table1">
                            <tr>
                                <td></td>
                                <td><div align="center" id="Contact"><a href="Contact.aspx" class="Tab2" id="tabnav" title="Contact">Contact</a></div></td>
                                <td></td>
                            </tr>
                        </table>
                    </td>
        </tr>
    </table>  

I would appreciate anyones help to make the tabs work in my code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等待我真够勒 2024-12-08 01:22:10

如果您使用 jQuery UI 选项卡,则工作已经为您完成:

http://jqueryui.com/demos/选项卡/

If you use the jQuery UI Tabs, the work is already done for you:

http://jqueryui.com/demos/tabs/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文