CSS3实现两头细中间粗的线(纵向)与一线两色\渐变线\文字投影\文字渐变等

136 篇文章 4 订阅
113 篇文章 1 订阅

注意:1rem==100px,可自行换算 

文字描边 

html:

<div class="answer-title">共2道题,全对即可集章成功,可重复答题</div>

css:

        .answer-title {
            font-size: 0.28rem;
            font-family: PingFangSC-Semibold, PingFang SC;
            font-weight: 600;
            color: #00FFEB;
            line-height: 0.4rem;
            letter-spacing: 1px;
            -webkit-text-shadow: -0.02rem 0.02rem 0 #004BFF, 0.02rem 0.02rem 0 #004BFF,0.02rem -0.02rem 0 #004BFF,-0.02rem -0.02rem 0 #004BFF;
            -moz-text-shadow: -0.02rem 0.02rem 0 #004BFF, 0.02rem 0.02rem 0 #004BFF,0.02rem -0.02rem 0 #004BFF,-0.02rem -0.02rem 0 #004BFF;
            -ms-text-shadow: -0.02rem 0.02rem 0 #004BFF, 0.02rem 0.02rem 0 #004BFF,0.02rem -0.02rem 0 #004BFF,-0.02rem -0.02rem 0 #004BFF;
            -o-text-shadow: -0.02rem 0.02rem 0 #004BFF, 0.02rem 0.02rem 0 #004BFF,0.02rem -0.02rem 0 #004BFF,-0.02rem -0.02rem 0 #004BFF;
            text-shadow: -0.02rem 0.02rem 0 #004BFF, 0.02rem 0.02rem 0 #004BFF,0.02rem -0.02rem 0 #004BFF,-0.02rem -0.02rem 0 #004BFF;
        }

效果:

1、文字中间粗两头细 

 html:

<div class="homeLine"></div>

css:

  .homeLine{
        width:1px;
        height:486px;
        background:linear-gradient(244deg,rgba(255,255,255,0) 0%,rgba(255,255,255,1) 50%,rgba(255,255,255,0) 100%);
    }

效果图:

2、一线两色

html:

<div class="blue-gray-line"></div>

css:

    .blue-gray-line{
      width: 300px; height: 23px; border-right: 150px solid rgba(216, 216, 216, 1); background: rgba(50, 91, 223, 1);
    }

效果图(想要细一点就调整高度):

3、渐变线 

html:

<div class="left-top-line"></div>

css:

  .left-top-line {
    width: 100%;
    height: 6px;
    background: linear-gradient(
      270deg,
      rgba(43, 250, 211, 1) 0%,
      rgba(43, 250, 211, 1) 50%,
      rgba(255, 171, 79, 1) 100%
    );

  }

效果图:

4、文字投影 

html:

<div class="activity-rules-text">活动规则</div>

css:

      .activity-rules-text{
          box-sizing: border-box;
          -moz-box-sizing: border-box;
          -webkit-box-sizing: border-box;
          font-size: 46px;
          font-family: Source Han Sans CN;
          font-weight: 800;
          text-align:justify;
          color: #E6D696;
          background: linear-gradient(180deg, blue 0%, blue 100%);
          text-shadow:#FAE260 -5px -5px 0px;
          -webkit-background-clip: text;
          -webkit-text-fill-color: transparent;
        
      }

效果图:

5、渐变文字 

html:

	<div class="text-panel">
		<!-- 文字必须用span包裹,不然不会出现渐变 -->
		<span class="text">
			Gradient Text(渐变文字)
		</span>
	</div>

css:

	.text-panel{
		padding: 300px;
		background-color: beige;
	}
   .text{
		    font-size: 30px;
		    background: linear-gradient(
		      228deg,
		      rgba(0, 100, 255, 1) 0%,
		      rgba(43, 250, 211, 1) 100%
		    );
		    background-clip: text;
		    -webkit-background-clip: text;
		    -o-background-clip: text;
		    -moz-background-clip: text;
		    -ms-background-clip: text;
		    color: transparent;
	}

效果图:

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值