2011-08-23 76 views
2

我在搜索如何在不使用圖像的情況下創建選項卡時找到了一個CSS文件。我遇到了CSS Tabs 2.0修改CSS文件以適合我的asp.net頁面

它服務我的目的。
但是,現在我需要定製它以適合我的asp.net頁面,而且我似乎無法獲得任何地方。
CSS文件使用<ul<li
我使用的是表<tr><td>

這是示例代碼:

<!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> 

我會感謝任何人幫助使標籤在我的公司工作德。

+0

所以,你希望有人把你當前的網站,並修改它讓你使用標籤2.0嗎?如果你至少自己嘗試一下,然後尋求幫助,這可能會很好。 – mrtsherman

+0

表格的tr和td正好用於建築物表格。我不確定您是否可以輕鬆地將它們製作爲製表符。你爲什麼不把它改成ul/li或類似的東西? –

+0

@Sheen,當前的代碼有表tr,tr和td,後者又有runat = server標記,並且正在後面的代碼中進行操作。 – Frank

回答

1

如果使用jQuery UI的標籤,工作已經爲你做了:

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

+0

是的,但使用jQuery會讓我的生活變得簡單...不幸的是,由於安全原因我不允許使用jquery(最終客戶端不允許是一個巨大的安全敏感店) – Frank

+1

您仍然可以使用在線樣本良好的語義HTML和CSS :) – IrishChieftain

+0

jQuery示例還使用ui&li ...這與我在o/p – Frank