HTML+CSS一级导航栏

本文通过一个简单的网页实例介绍了HTML和CSS的基本用法。包括HTML文档结构、CSS样式定义及超链接样式控制等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

大一学的都忘记了,有机会重新学习一遍,简单记录下(小傻猫),日常
记录学习

HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link href="../CSS/Top导航栏.css" type="text/css" rel="stylesheet">
    <title>Document</title>
</head>
<body>
  <div class="index">
      <div class="header">页眉</div>
      <div class="nav">
                <a href="text1.html">主页</a>
                <a href="#">音乐</a>
                <a href="#">运动</a>
                <a href="#">美食</a>
                <a href="#">休闲</a>
      </div>
  </div>
</body>
</html>
CSS

*{
    margin: 0;
    padding: 0;
}
body{
    background-color:white;
}
.header{
    margin: 0 auto;
    width: 100%;
    height: 30px;
    background-color: seashell;
    text-align: center;
}

.nav{
    
    margin: 0 auto;
    width: 100%;
    height: 40px;
    background-color: lightblue;  
    font-size: 18px;
    text-indent: 2em;
    line-height: 2em; /*距离上边线的距离*/
    text-align: justify;
}

a{
    margin-right: 90px;/*超链接 相对于左右边的距离的设置   */
    margin-left:100px;
    font-size: 18px;   /* 文字大小的设置   */
    color:pink;     /* 连接字体的颜色  */
    text-decoration: none;  /*消除掉超链接下面的横线*/
}

/* 未访问时的状态 ,访问过的状态 */
a:link,a:visited{
    color: #333333;
} 

/* 鼠标经过连接上的状态 */
a:hover{
    color: lightgoldenrodyellow;
}
/* 鼠标点击连接的状态 */
a:active{
 color: lightseagreen;    
}

效果:
在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值