VUE--简易的css样式合集

一、css样式常用合集

/* 宽度 */
width: 450px;
/* 高度 */
height: 300px;
/* 字体颜色 */
color:red;
/* 封面背景色 */
background: #fff;
/* 属性定位(与下方top和left是组合使用)position位置:absolute全部 */
position: absolute;
/* 属性定位,顶部占比 */
top: 50%;
/* 属性定位,左侧占比 */
left: 50%;
/* 有的时候两个按钮排列在一起,此时是上下显示的,这个时候我们可以用对齐的方式进行在一行展示 */
/* 按钮左对齐 */
float: left;
/* 按钮右对齐 */
float: right;
/* 水平对齐:文本排列到中间 */
text-align: center

二、css样式组合demo

1、header简易布局(文字与图片重叠展示)

(1)添加背景图
(2)左侧展示文案
(3)右侧展示退出按钮

<template>
  <el-container>
    <div class="imgUrl">
    
      <div class="titleText">
        title文案xxxxxxx
      </div>
      
      <div class="btn">
        <el-button @click="loginOut" type="primary">退出</el-button>
      </div>
      
    </div>
  </el-container>
</template>

<script>

</script>

<style>
	.el-header {
		/* 设置行间的距离(行高) */
	    line-height: 50px; 
	    color: rgb(250, 248, 248);
	    /* 字体大小 */
	    font-size: 20px;
	  }

  .imgUrl {
  	/* url里面是图片链接,也可以是本地地址 */
    background: url('../../../src/assets/20211206193128.jpg');
    /* 图片大小占比 */
    background-size: 100% 100%;
    /* 图片宽度 */
    width: 100%;
  }

  .titleText {
  	/* 左对齐 */
    float: left;
    /* 左间距挪20像素 */
    margin-left:20px
  }

  .btn {
  	/* 右对齐 */
    float: right;
    /* 右间距挪20像素 */
    margin-right:20px
  }
</style>

样式展示效果
在这里插入图片描述

2、表单内的一个小样式(文案与图片重叠展示)
<div style="position: relative">
   <img :src="item.icon_url" alt="item.title" width="100%" height="24px">
   <span style="position: absolute; top: 3px; left: 23px; color:#fff ;font-size: 10px">{{item.title}}
   </span>
</div>

样式展示效果
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值