html css jquery选项卡 代码练习小项目

在学习 html 和 css jquery 结合使用的时候 做好是能尝试做一些简单的小功能,来提高自己的 逻辑能力,熟悉代码的编写语法

下面分享一段代码 使用html css jquery选项卡 代码练习

bash 复制代码
<div class="box">
    <dl class="tab">
        <dd class="active">手机</dd>
        <dd>家电</dd>
        <dd>服装</dd>
        <dd>数码</dd>
        <dd>玩具</dd>
    </dl>
    <div class="goods">
        <div class="current"><h1>手机商品</h1></div>
        <div><h1>家电商品</h1></div>
        <div><h1>服装商品</h1></div>
        <div><h1>数码商品</h1></div>
        <div><h1>玩具商品</h1></div>
    </div>

html 使用的是 div dl dd标签实现的

下面是css 代码

简单的写了一些 css 样式

bash 复制代码
      *{
            margin:0;
            border:0;
            padding:0;
        }
        .box{
            width: 1000px;
            margin:50px auto;
        }


        .tab dd{
            float:left;
            width:100px;
            padding:3px;
            margin-right:1px;
            background: #FF0000;
            color:#fff;
            text-align: center;
            cursor: pointer;
        }
        .tab dd:hover,.tab dd.active{
            background: #990000;
        }
        .goods{
            clear:both;
        }
        .goods div{
            display: none;
        }
        .goods div.current{
            display: block;
        }

代码实现起来还是比较简单的 有兴趣的 兄弟们可以尝试练习以下

全部代码获取传送门:https://wwwoop.com/home/Index/projectInfo?goodsId=15&typeParam=2

相关推荐
程序员小羊!30 分钟前
01HTML预备知识
前端·html
a11177619 小时前
粒子化系统(3D-Particles)THreeJS react
前端·html·jetson
码农君莫笑19 小时前
深入理解 CSS Grid 布局:从入门到实战
前端·css
半壶清水21 小时前
用python脚本加html自建的书法字典
开发语言·python·html
用户0595401744621 小时前
把Agent记忆测试从Mock换到真实Redis,漏测率从30%降到0
前端·css
YG亲测源码屋1 天前
html表白代码大全可复制免费 html表白网页制作源码
前端·html
LIUAWEIO2 天前
CSS 让鼠标呈现手型,鼠标悬浮变小手
css·html·css3·html5
ZC跨境爬虫2 天前
跟着 MDN 学CSS day_51:支持旧浏览器的布局策略
前端·css·html·tensorflow·媒体
Larcher2 天前
从 0 到 1:Node.js 调用 AI API 的完整避坑指南
前端·javascript·css
八目蛛2 天前
八目蛛网络(免费工具网站导航)
css·vue.js·开源·vue3·html5·ai编程