登录页面样式设置

<template>
  <div class="login-container">
    <el-form
      :model="form"
      status-icon
      :rules="rules"
      ref="ruleForm"
      label-width="80px"
      class="login-from"
    >
      <h2 class="login-title">CC&会员管理系统</h2>
      <el-form-item label="账户">
        <el-input type="text" :v-model="form.username"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input type="password" :v-model="form.password"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')"
          >提交</el-button
        >
        <el-button @click="resetForm('ruleForm')">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        username: '',
        password: ''
      }
    };
  },
  methods: {
    submitForm() {
      console.log('登录');
    }
  }
};
</script>
<style scoped>
/* 表单样式设置 */
.login-from {
  width: 350px;
  /* 居中 */
  margin: 35vh auto;
  background-color: rgb(255, 255, 255, 0.6);
  padding: 30px;
  border-radius: 20px;
}

/* 背景样式设置 */
.login-container {
  position: absolute;
  width: 100%;
  height: 100%;
  /* 背景图片的设置 */
  background: url('../../assets/login.jpg') no-repeat;
  background-size: 100% 100%;
}

/* 表单标题样式设置 */
.login-title {
  color: #303133;
  /* 居中 */
  text-align: center;
}
</style>

静态资源放在 assets中

​​​​​​​

发现问题:背景图距离上方左方有一定的间距

原因:div默认有8像素

解决:app.vue中设置body样式 margin:0 auto; 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值