欢迎访问 如意编程网!

如意编程网

当前位置: 首页 > 前端技术 > HTML >内容正文

HTML

html+css自定义导航

发布时间:2022/11/16 HTML 25 老码农
如意编程网 收集整理的这篇文章主要介绍了 html+css自定义导航 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

    利用css来编写的导航条,先看看效果:

html+css自定义导航

代码区:

  html:

<!--导航部分-->
{block name="nav"}
    <nav>
        <div>
            <ul>
                <li><a href="{:url('UserManage/index')}"><img src="__PUBLIC__/static/img/logo.jpg"></a></li>
                <li><a href="{:url('UserManage/index')}">用户管理</a></li>
                <li><a href="{:url('CaseManage/index')}">用例管理</a></li>
                <li>
                    <div id="login_name">
                        <span><i>&#xe612;</i>&nbsp;{$Think.session.loginUser->name}</span>
                    </div>
                    <div id="logout">
                        <a href="{:url('Login/loginOut')}"><i>&#xe609;</i>&nbsp;退出</a>
                    </div>
                </li>
            </ul>
        </div>
    </nav>
{/block}

  css:

/*导航部分*/
.nav {
    background: #000000;
    height: 60px;
    margin: 0 auto;
}
.nav ul {
    list-style: none;
}
.nav .first {
    float: left;
}
.nav .first img{
    width: 120px;
    height: 60px;
}
.menu {
    float: left;
    line-height: 60px;
    text-align: center;
}
.menu a {
    text-decoration: none;
    color: white;
    display: block;
    width: 85px;
    height: 60px;
    font-size: 15px;
}
.menu a:hover {
    background: #0f0f0f;
    color: green;
}
/*显示用户,退出*/
.nav .last{
    float: right;
    line-height: 60px;
    margin-right: 20px;
    text-align: center;
}
#login_name{
    font-size: 15px;
    color: white;
    display: inline;
}
#logout {
    display: inline;
    margin-left: 20px;
}
#logout a{
    color: white;
    text-decoration: none;
}
/*导航部分*/

 

总结

以上是如意编程网为你收集整理的html+css自定义导航的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得如意编程网网站内容还不错,欢迎将如意编程网推荐给好友。