Node.js + express + socket 实现在线实时多人聊天室

项目目录结构:




前端部分:


登录页面Login部分:


login.html


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>login</title>
    <link rel="stylesheet" href="css/login.css">
</head>

<body>
    <div class="login-box flex-box">
        <!--登录标题栏-->
        <h2 class="sign-title box-width">LOGIN</h2>
        <!--头像栏-->
        <div class="picture-carousel">
            <div class="arrow left-arrow">
                <div class="before-arrow"></div>
            </div>
            <img class="p1 img-setting" src="img/1.png" alt="1.png">
            <img class="p2 img-setting" src="img/2.png" alt="2.png">
            <img class="p3 img-setting" src="img/3.png" alt="3.png">
            <img class="p2 img-setting" src="img/4.png" alt="4.png">
            <img class="p1 img-setting" src="img/5.png" alt="5.png">
            <div class="arrow right-arrow">
                <div class="after-arrow"></div>
            </div>
        </div>
        <!--用户名栏-->
        <div class="name-box box-width">
            <input type="text" class="user-name box-width" placeholder="Please Type Your Name">
        </div>
        <!--确认栏-->
        <div class="button-box box-width">
            <input type="button" class="login-button box-width" value="Login The Chatroom">
        </div>
        <!--错误信息栏-->
        <div class="error-box box-width">
            <span class="error-message">Welcome to chatroom!</span>
        </div>
    </div>
</body>
<script src="js/login.js"></script>

</html>

login.css

* {
    padding: 0;
    margin: 0;
    font-family: "Microsoft Yahei";
}

html,
body {
    width: 100%;
    height: 100%;
    font-family: "Microsoft Yahei";
    display: flex;
    justify-content: center;
    align-items: center;
}

body {
    background: linear-gradient(-135deg, #51D15B, #42A855);
    background: -moz-linear-gradient(-135deg, #51D15B, #42A855);
    background: -webkit-linear-gradient(-135deg, #51D15B, #42A855);
    background: -o-linear-gradient(-135deg, #51D15B, #42A855);
}

.flex-box {
    display: flex;
    justify-content: center;
    align-items: center;
}

.box-width {
    width: 80%;
}


/*最外层*/

.login-box {
    width: 20%;
    min-width: 304px;
    max-width: 404px;
    height: 50%;
    min-height: 368px;
    max-height: 468px;
    flex-direction: column;
    box-shadow: 1px 1px 15px #7B8C99;
    background: #fff;
}


/*LOGIN标题*/

.sign-title {
    color: #42A855;
    border: 2px solid #42A855;
    border-top: transparent;
    border-left: transparent;
    border-right: transparent;
}


/*图片切换*/

.picture-carousel {
    position: relative;
    display: flex;
    margin: 10%;
}


/*图片切换箭头*/

.arrow {
    z-index: 3;
    position: absolute;
    font-size: 60px;
    height: 100%;
    width: 30%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #ffffff;
}

.arrow:hover {
    cursor: pointer;
}

.left-arrow {
    left: 0;
}

.before-arrow {
    width: 0px;
    height: 0px;
    border-width: 30px;
    border-style: solid;
    border-color: transparent #51D15B transparent transparent;
}

.right-arrow {
    right: 0;
}

.after-arrow{
     width: 0px;
    height: 0px;
    border-width: 30px;
    border-style: solid;
    border-color: transparent  transparent transparent #51D15B; 
}

.picture-carousel img {
    width: 80px;
    height: 80px;
    transition: all 0.2s linear;
    -moz-transition: all 0.2s ease-out;
    -webkit-transition: all 0.2s ease-out;
    -o-transition: all 0.2s ease-out
  • 8
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值