HTML和CSS实现京东登录页面(html,css代码详解)

HTML代码

基本布局

在这里插入图片描述

QQ:2248557717

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>京东-欢迎登陆</title>
    <meta name="keywords" content="京东在线商城">
    <meta name="description" content="电商网站">
    <link rel="icon" href="favicon.ico">
    <link rel="stylesheet" href="./css/login.css">
    <link rel="stylesheet" href="./css/base.css">
</head>
<body>
<!--登录头部开始-->
<div class="login_w">
    <div class="l_login">
        <a href="#">京东首页</a>
        <b></b>
    </div>
    <div class="r_login">
        <a href="#">登录页面,调查问卷</a>
        <b></b>
    </div>
</div>
<!--登录头部结束-->

<!--主体开始-->
<div class="main_content">
    <div class="text">
        <b></b>
        <p>依据《网络安全法》,为保障您的账户安全和正常使用,请尽快完成手机号验证! 新版《京东隐私政策》已上线,将更有利于保护您的个人隐私。</p>
    </div>
    <div class="login_w">
        <div class="form">
            <div class="form_text">
                <p>京东不会以任何理由要求您转账汇款,谨防诈骗。</p>
                <b></b>
            </div>
            <div class="top">
                <a href="#">扫码登录</a>
                <a href="#" class="one">账户登录</a>
            </div>
            <div class="middle">
                <div class="inputs">
                    <input type="text" class="public user">
                    <input type="text" class="public pwd">
                    <span class="user_img"></span>
                    <span class="pwd_img"></span>
                    <a href="#">忘记密码</a>
                    <input type="button" class="btn" value="登&nbsp;&nbsp;&nbsp;&nbsp;录">
                </div>
            </div>
            <div class="bottom">
                <a href="#" class="qq">
                    <b></b>QQ
                </a>
                <a href="#" class="wx">
                    <b></b>微信
                </a>
                <a href="#" class="register">
                    <b></b>立即注册
                </a>
            </div>
        </div>
    </div>
</div>
<!--主体结束-->

<!--尾部开始-->
<div class="footer">
    <p>
        <a href="#">关于我们 </a>|
        <a href="#">联系我们 </a>|
        <a href="#">人才招聘 </a>|
        <a href="#">商家入驻 </a>|
        <a href="#">广告服务 </a>|
        <a href="#">手机京东 </a>|
        <a href="#">友情链接 </a>|
        <a href="#">销售联盟 </a>|
        <a href="#">京东社区 </a>|
        <a href="#">京东公益 </a>|
        <a href="#">English Site</a>
    </p>
    <p class="copyright">Copyright © 2004-2020  京东JD.com 版权所有</p>
</div>
<!--尾部结束-->
</body>
</html>

css代码

初始化文件(base.css)
p,h1,h2,h3,h4,h5,h6,ul,li,ol,dl,dd,dt,body{
    margin: 0;
    padding: 0;
    font-size: 12px;
    font-family: "微软雅黑";
    color: #666666;
    list-style: none;
}
img,input{
    outline-style: none;
    padding: 0;
    margin: 0;
    border: none;
    vertical-align: middle;
}
.clearfix::after{
    content: "";
    height: 0px;
    line-height: 0px;
    clear: both;
    visibility: hidden;
    display: block;
}
.clearfix{
    *zoom:1;
}
a{
    text-decoration: none;
    color: #666666;
}
a:hover{
    color:#e4393c;
}
/*登录的版心*/
.login_w{
    width: 990px;
    margin: 0 auto;
}
/*首页的版心*/
.w{
    width: 1190px;
    margin: 0 auto;
}
login.css
.login_w{
    background-color: white;
    height: 92px;
}
.l_login{
    float: left;
    padding-top: 22px;
}
.r_login{
    float: right;
    padding-top: 65px;
    position: relative;
}
.r_login b{
    width: 18px;
    height: 14px;
    display: block;
    background: url("../images/q-icon.png") no-repeat;
    position: absolute;
    left: -22px;
    bottom: -1px;
}
.l_login a{
    width: 170px;
    height: 60px;
    display: inline-block;
    background: url("../images/logo-201305-b.png") no-repeat;
    text-indent: -2000px;
    vertical-align: bottom;
}
.l_login b{
    width: 110px;
    height: 40px;
    display: inline-block;
    background: url("../images/l-icon.png") no-repeat;
    vertical-align: bottom;
}
.text{
    height: 35px;
    background-color: #fff8f0;
    line-height: 35px;
    text-align: center;
    position: relative;
}
.text b{
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url("../images/icon-tips.png") no-repeat;
    position: absolute;
    left: 268px;
    top: 9px;
}
.main_content{
    width: 100%;
    height: 510px;
    background-color: #e93854;
}
.main_content .login_w{
    height: 475px;
    background: url("../images/登录背景.png") no-repeat;
}
.main_content .form{
    width: 346px;
    height: 400px;
    box-sizing: border-box;
    background-color: #fff;
    float: right;
    margin-top: 10px;
}
.main_content .form_text{
    height: 38px;
    background-color: #fff8f0;
    line-height: 38px;
    padding-left: 50px;
    position: relative;
}
.main_content .form_text b{
    display: block;
    width: 16px;
    height: 16px;
    background: url("../images/icon-tips.png") no-repeat;
    position: absolute;
    top: 11px;
    left: 30px;
}
.main_content .top{
    height: 54px;
    line-height: 54px;
    display: flex;
    border-bottom: 1px solid #ccc;
    text-align: center;
}
.main_content .top a{
    flex: 1;
    font-size: 18px;
    font-weight: 700;
    border-right: 1px solid #ccc;
}
.main_content .top .one{
    border-right: none;
}
.form .middle{
    padding-top: 33px;
    padding-left: 20px;
    padding-right: 20px;
}
.form .middle .public{
    width: 304px;
    height: 38px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
    padding-left: 50px;
    box-sizing: border-box;
}
.form  .inputs {
    position: relative;
}
.form .middle  span {
    display: block;
    width: 36px;
    height: 36px;
    border-right: 1px solid #ccc;
    background-color: #f3f3f3;
    position: absolute;
}
.form .middle  .user_img {
    top: 1px;
    left: 1px;
    background: url("../images/pwd-icons-new.png") no-repeat;
}
.form .middle .pwd_img {
    top: 59px;
    left: 1px;
    background: url("../images/pwd-icons-new.png") no-repeat -48px 0px;
}
.inputs a {
    float: right;
}
.inputs .btn {
    width: 100%;
    height: 36px;
    background-color: #e4393c;
    color: #fff;
    margin-top: 20px;
    font-size: 20px;
    text-align: center;
}
.bottom {
    margin-top: 30px;
    border-top: 1px solid #ccc;
    height: 55px;
    line-height: 55px;
    color: #cccccc;
}
.qq,.wx{
    display: inline-block;
    width: 70px;
    height: 55px;
    padding-left: 35px;
    box-sizing: border-box;
}
.bottom a {
    position: relative;
}
.qq b {
    width: 19px;
    height: 18px;
    display: block;
    background: url("../images/QQ-weixin.png") no-repeat;
    position: absolute;
    top: 18px;
    left: 13px;
}
.wx b{
    width: 19px;
    height: 18px;
    display: block;
    background: url("../images/QQ-weixin.png") no-repeat right;
    position: absolute;
    top: 18px;
    left: 13px;
}
.bottom .register{
    margin-left: 120px;
    font-size: 15px;
}
.bottom .register b{
    width: 19px;
    height: 18px;
    display: block;
    background: url("../images/pwd-icons-new.png") no-repeat -104px -75px;
    position: absolute;
    top: 2px;
    left: -20px;
}
.footer {
    text-align: center;
    padding-top: 20px;
}
.footer  a {
    padding: 0 10px;
}
.footer .copyright{
    padding-top: 15px;
    padding-bottom: 40px;
}

效果展示

在这里插入图片描述
在这里插入图片描述

  • 55
    点赞
  • 265
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
实现京东首页的基本步骤如下: 1. 设计页面结构和布局:确定页面的整体结构,包括页面头部、导航栏、轮播图、商品分类、推荐商品等。 2. 编写 HTML 代码:根据页面结构和布局设计,编写 HTML 代码实现页面的基本结构。 3. 使用 CSS 实现页面样式:使用 CSS 样式表实现页面的基本样式,包括颜色、字体、布局、边框等。 4. 实现轮播图效果:使用 JavaScript 或 jQuery 等技术实现轮播图效果,提升页面的交互性和用户体验。 5. 实现商品分类和推荐商品效果:使用 JavaScript 或 jQuery 等技术实现商品分类和推荐商品效果,提升页面的交互性和用户体验。 6. 针对不同设备进行优化:通过响应式设计或移动端适配等技术,针对不同设备进行优化,提升用户体验。 7. 进行测试和优化:对页面进行测试,发现问题并进行优化,确保页面的稳定性和性能。 具体代码实现可以参考以下示例: HTML 代码: ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>京东首页</title> <link rel="stylesheet" href="style.css"> </head> <body> <header> <!-- 页面头部内容 --> </header> <nav> <!-- 导航栏内容 --> </nav> <section class="slider"> <!-- 轮播图内容 --> </section> <section class="category"> <!-- 商品分类内容 --> </section> <section class="recommend"> <!-- 推荐商品内容 --> </section> <footer> <!-- 页面底部内容 --> </footer> </body> </html> ``` CSS 代码: ```css /* 页面基本样式 */ body { font-family: Arial, sans-serif; font-size: 14px; margin: 0; padding: 0; } /* 页面布局 */ header, nav, section, footer { margin: 0 auto; max-width: 1200px; } /* 导航栏样式 */ nav { background-color: #333; color: #fff; height: 50px; line-height: 50px; } nav ul { margin: 0; padding: 0; } nav li { display: inline-block; margin-right: 20px; } nav a { color: #fff; text-decoration: none; } nav a:hover { text-decoration: underline; } /* 轮播图样式 */ .slider { height: 400px; overflow: hidden; position: relative; } .slider ul { list-style: none; margin: 0; padding: 0; position: absolute; top: 0; left: 0; } .slider li { float: left; width: 100%; } .slider img { width: 100%; } /* 商品分类样式 */ .category { margin-top: 20px; } .category h2 { font-size: 18px; margin-bottom: 10px; } .category ul { list-style: none; margin: 0; padding: 0; } .category li { float: left; width: 25%; } .category a { color: #333; display: block; padding: 10px 0; text-align: center; text-decoration: none; } .category a:hover { background-color: #f5f5f5; } /* 推荐商品样式 */ .recommend { margin-top: 20px; } .recommend h2 { font-size: 18px; margin-bottom: 10px; } .recommend ul { list-style: none; margin: 0; padding: 0; } .recommend li { float: left; width: 20%; margin-right: 2%; } .recommend a { color: #333; display: block; padding: 10px 0; text-align: center; text-decoration: none; } .recommend a:hover { background-color: #f5f5f5; } ``` 以上就是一个简单的京东首页的 HTMLCSS 实现,可以根据实际需求进行修改和优化。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值