Css+Div的选项卡

 

 1 <% @ Page Language = " C# "  AutoEventWireup = " true "  CodeFile = " ShowInfo.aspx.cs "  Inherits = " House_ShowInfo "   %>
 2 < html xmlns = " http://www.w3.org/1999/xhtml "   >
 3 < head runat = " server " >
 4      < title > 无标题页 </ title >
 5     < link rel = " stylesheet "  href = " ../css/scollbar.css "  type = " text/css " >
 6      < link rel = " stylesheet "  href = " ../css/mm.css "   type = " text/css " >
 7      < style >
 8             .buttonClose
 9             {
10               width:100px;height:25px; 
11               border :solid 1px #cccccc;
12               text-align:center;
13               cursor:hand;                      
14           }

15           .buttonOpen
16             {
17               width:100px;height:25px;text-align:center;
18               border-left:solid 1px #cccccc;
19               border-right:solid 1px #cccccc;
20               border-top:solid 1px #cccccc;
21               background-color:#ffffff;    
22           }

23            .panelWorker
24             {
25               background-color:#ffffff;
26               border-left:solid 1px #cccccc;
27               border-right:solid 1px #cccccc;
28               border-bottom:solid 1px #cccccc;
29           }

30           .panelClose
31             {
32             display:none;
33           }

34           .panelOpen
35            {
36           display:;
37          }

38          </ style >       
39 </ head >    
40   < script language = javascript >
41    var buttonIdArray = new  Array();
42     buttonIdArray[ 0 ] = ' House_Navigation ' ;
43     buttonIdArray[ 1 ] = ' User_Navigation ' ;
44     buttonIdArray[ 2 ] = ' Server_Navigation ' ;
45                                                 
46   var panelIdArray = new  Array();
47   panelIdArray[ 0 ] = ' Panel_House ' ;
48   panelIdArray[ 1 ] = ' Panel_User ' ;
49   panelIdArray[ 2 ] = ' Panel_Server ' ;
50   
51  function __OpenPanel(buttonObject,panelObjectId)
52   
53     for(var i=0;i<buttonIdArray.length;i++)
54      {
55     var _button=document.getElementById(buttonIdArray[i]);
56    var _panel=document.getElementById(panelIdArray[i]);
57    _button.className="buttonClose";
58     _panel.className="panelClose";
59      }
    
60  buttonObject.className="buttonOpen";
61  document.getElementById(panelObjectId).className="panelOpen";
62   }

63
64      </ script >  
65 < body style = " margin:0px 0px 0px 0px; " >
66      < form id = " form1 "  runat = " server " >
67             < table style = " width:50%; "  cellpadding = 0  cellspacing = 0   >
68                  < tr >
69                      < td id = " House_Navigation "   class = " buttonOpen "  onclick = " __OpenPanel(this,'Panel_House') "  style = " height: 26px " > 房管导航 </ td >
70                      < td style = " width:5px; border-bottom:solid 1px #cccccc; height: 26px; " >& nbsp; </ td >
71                      < td id = " User_Navigation "   class = " buttonClose "  onclick = " __OpenPanel(this,'Panel_User') "  style = " height: 26px " > 客户导航 </ td >
72                      < td style = " width:5px; border-bottom:solid 1px #cccccc; height: 26px; " >& nbsp; </ td >                                                 
73                      < td id = " Server_Navigation "    class = " buttonClose "  onclick = " __OpenPanel(this,'Panel_Server') "  style = " height: 26px " > 服务导航 </ td >
74                      < td style = "  border-bottom:solid 1px #cccccc; height: 26px; " >& nbsp; </ td >
75                  </ tr >
76                  < tr >
77                      < td colspan = " 6 "   class = " panelWorker "   >
78                          < asp:Panel ID = " Panel_House "  runat = " server "  Height = " 50px "  Width = " 100% "  BorderColor = " #C0C0FF " >< asp:Button ID = " Button1 "  runat = " server "  Text = " Button "   /> a </ asp:Panel >
79                    
80                          < asp:Panel ID = " Panel_User "  runat = " server "  CssClass = " panelClose "  Height = " 50px "  Width = " 100% "  BorderColor = " #C0FFC0 " >
81                              < asp:Button ID = " Button2 "  runat = " server "  Text = " Button "   />
82                              < asp:Button ID = " Button3 "  runat = " server "  Text = " Button "   /></ asp:Panel >
83                
84                          < asp:Panel ID = " Panel_Server "  runat = " server "  CssClass = " panelClose "  Height = " 50px "  Width = " 100% " >
85                              < asp:Button ID = " Button4 "  runat = " server "  Text = " Button "   />
86                              < asp:Button ID = " Button5 "  runat = " server "  Text = " Button "   />
87                              < asp:Button ID = " Button6 "  runat = " server "  Text = " Button "   /></ asp:Panel >
88                      </ td >
89                  </ tr >
90          </ table >
91      </ form >
92 </ body >
93 </ html >
94

转载于:https://www.cnblogs.com/lovecrystal/archive/2007/12/22/1010712.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,我可以为您解答这个问题。 首先,我们需要使用HTML和CSS来创建选项卡的基本结构和样式,然后使用JavaScript来实现选项卡的切换效果。 HTML结构: ```html <div class="tabs"> <div class="tab active" data-tab="1"> <img src="image1.jpg"> <p>选项卡1</p> </div> <div class="tab" data-tab="2"> <img src="image2.jpg"> <p>选项卡2</p> </div> <div class="tab" data-tab="3"> <img src="image3.jpg"> <p>选项卡3</p> </div> <div class="tab" data-tab="4"> <img src="image4.jpg"> <p>选项卡4</p> </div> <div class="tab" data-tab="5"> <img src="image5.jpg"> <p>选项卡5</p> </div> <div class="tab" data-tab="6"> <img src="image6.jpg"> <p>选项卡6</p> </div> </div> ``` CSS样式: ```css .tabs { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; } .tab { width: calc(33.33% - 10px); margin-bottom: 20px; padding: 20px; text-align: center; background-color: #f6f6f6; cursor: pointer; } .tab img { max-width: 100%; height: auto; } .tab p { margin-top: 10px; font-size: 18px; } .tab.active { background-color: #f00; color: #fff; } ``` JavaScript代码: ```javascript const tabs = document.querySelectorAll('.tab'); tabs.forEach(tab => { tab.addEventListener('click', () => { const activeTab = document.querySelector('.tab.active'); if (activeTab) activeTab.classList.remove('active'); tab.classList.add('active'); }); }); ``` 以上代码实现了一个六个横向排版的选项卡,并且可以通过点击选项卡来切换背景颜色。每个选项卡上面是一张图片,下面是一段文本。同,这个选项卡还是一个响应式的设计。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值