首页 > 其他分享 >html+css:小米顶部菜单+二级菜单

html+css:小米顶部菜单+二级菜单

时间:2022-12-30 20:11:21浏览次数:42  
标签:菜单 sub color height header html margin css 38px

1、源码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .header{
            /*height:38px;*/
            background-color: #333;
        }
        .header .menu{
            float: left;
            color: white;
            /*height: 38px;*/
            /*!*垂直居中*!*/
            /*line-height: 38px;*/
        }
        .header .account{
            float: right;
            color: white;
            /*height: 38px;*/
            /*line-height: 38px;*/
        }
        /*将部件放到容器中,实现居中*/
        .container{
            width: 1000px;
            margin-top: 0;
            margin-left: auto;
            margin-right: auto;
        }
        .header a{
            color:#b0b0b0;
            line-height: 40px;
            display: inline-block;
            /*内部有了高度,外部就不用设置了*/
            font-size: 12px;
            margin-right: 10px;
            text-decoration: none;
        }
        .header a:hover{
            color: white;
        }
        .body{
            margin: 0;
        }
        .sub-header{
          height: 100px;
          /*background-color: #b0b0b0;*/
        }
        .sub-header .ht{
          height: 100px;
        }
        .sub-header .logo{
            width: 234px;
            float:left;
            /*border: 1px solid red;*/
        }
        .sub-header .menu-list{
          float: left;
            line-height: 100px;
            /*border: 1px solid red;*/
        }
        .sub-header .menu-list a{
          display: inline-block;
            padding: 0 10px;
            color: #333333;
            font-size: 16px;
            /*去掉标签的下划线*/
            text-decoration: none;
        }
        /*放上鼠标,改变颜色*/
        .sub-header .menu-list a:hover{
            color:#ff6700;
        }
        .sub-header .search{
          float: right;
        }
        .sub-header .logo a{
            /*图片居中只能使用内外边距*/
            margin-top: 22px;
            display:inline-block;
        }
        .sub-header .logo a img{
            height: 56px;width: 56px
        }
    </style>
</head>
<body >
    <div class = "header">
        <div class="container">
            <div class = "menu">
                <a href="https://www.mi.com/index.html">小米商城</a>
                <a href="https://www.mi.com/index.html">MIUI</a>
                <a href="https://www.mi.com/index.html">云服务</a>
                <div style="width: 200px;text-align: center"></div>
            </div>
            <div class = "account">
                <a href="https://www.mi.com/index.html">登录</a>
                <a href="https://www.mi.com/index.html">注册</a>
            </div>
            <div style="clear: both"></div>
        </div>
    </div>
    <div class="sub-header">
        <div class="container">
            <div class = "ht  logo">
              <!--a标签默认为行内标签,设置高度、边距无效。->变成块级标签 || 块级+行内-->
              <a href="https://www.mi.com/index.html">
                <img src="/static/xiaomi.png">
              </a>
            </div>
            <div class="ht menu-list">
                <a href="https://www.mi.com/index.html" >小米手机</a>
                <a href="https://www.mi.com/index.html">电视</a>
                <a href="https://www.mi.com/index.html">笔记本</a>
            </div>
            <div class = "ht search"></div>
            <div class="clear:both"></div>
        </div>
    </div>
</body>
</html>

2、效果展示
image
3、小结
image

标签:菜单,sub,color,height,header,html,margin,css,38px
From: https://www.cnblogs.com/N-lim/p/17015732.html

相关文章

  • spring boot 整合 itextpdf 导出 PDF,写入大文本,写入HTML代码,分析当下导出PDF的几个工
    文章目录前言一、java导出PDF的几个工具1.PDFBox2.JasperReports/jFreeReport导出报表PDF3.itextpdf导出PDF(敲重点)二、springboot整合itextpdf三、两个案例1.写入......
  • webpack学习四:使用webpack配置plugin,来使用HtmlWebpackPlugin、uglifyjs-webpack-plug
    文章目录​​前言​​​​一、plugin是什么?​​​​二、添加版权的Plugin:BannerPlugin​​​​三、打包html的plugin:html-webpack-plugin​​​​四、js压缩的Plugin:uglifyj......
  • css 改变滚动条样式
     /*滚动条样式start*/::-webkit-scrollbar{width:3px;height:8px;}::-webkit-scrollbar-button{width:0;he......
  • VSCode添加到右键菜单命令
    一、打开注册表win+R输入regedit,打开注册表编辑器二、文件添加右键VScode打开命令依次找到HKEY_CLASSES_ROOT>*>shell,右键新建,项,命名为VSCode,点击VScode文件夹,双击......
  • html css js复习
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content=......
  • 视频直播app源码,css预加载旋转动画与流光字体
    视频直播app源码,css预加载旋转动画与流光字体一、预加载旋转动画css body{}.concentric_round{width:200rpx;height:200rpx;position:relative;position:absolu......
  • Java 将HTML转为XML
    本文介绍如何通过Java后端程序代码来展示如何将html转为XML。此功能通过采用WordAPI-​​FreeSpire.DocforJava​​提供的Document.saveToFile()方法来实现;该方法支持的......
  • CSS样式
    1、高度和宽度<style>.c1{height:300px;}.c2{width:10px;}</style>宽度支持百分比,高度不支持百分......
  • jquery改变css样式和vue改变样式的区别
    jQuery做的就是操作dom节点,从而去改变css样式;而vue不用操作DOM,只关心数据,是从数据绑定的角度去改变样式的先来看看jQuery,我用的是vue框架,所以先安装jQuerynpminstal......
  • CSS快速入门
    1、CSS基础知识CSS:专门用来美化HTML"标签"CSS应用方式:①直接在标签上应用<imgsrc="..."style="height:100px">②在head标签中写style标签<!DOCTYPEhtml><ht......