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

相关推荐
bluceli1 天前
CSS容器查询:响应式设计的新范式
前端·css
Bigger1 天前
CSS 这些年都经历了什么?一次看懂 CSS 的演化史
前端·css·前端工程化
anOnion2 天前
构建无障碍组件之Switch Pattern
前端·html·交互设计
大漠_w3cpluscom2 天前
使用 clip-path: shape() 创建 Squircle 形状
前端·css·weui
会员源码网4 天前
告别参数混乱:如何优雅解决方法参数过多导致的可维护性难题
css
Lee川5 天前
现代Web开发中的CSS继承、Flexbox布局与LocalStorage交互:从文档解析到实践应用
前端·css
helloweilei6 天前
CSS进阶: background-clip
css
DeathGhost6 天前
CSS container容器查询
前端·css
不会敲代码17 天前
前端组件化样式隔离实战:React CSS Modules、styled-components 与 Vue scoped 对比
css·vue.js·react.js
Sailing7 天前
🚀 别再乱写 16px 了!CSS 单位体系已经进入“计算时代”,真正的响应式布局
前端·css·面试