纯css实现多行文本右下角最后一行展示全部按钮

未展开全部:

展开全部:

综上演示按钮始终保持在最下方

css代码如下:

<div class="info-content">
	<div class="info-text" :class="!showAll ? 'mle-hidden' : ''">
		<span class="show-all" @click="handleShowAll">
			{{ showAll ? "收起" : "展开" }}
            <span class="arrow" :class="showAll ? 'active' : ''"></span>
		</span>
	    【预置内容】质量标签信息内容信息质量标签内容质量标签信息内容信息质量标签内容
	</div>
</div>

css代码如下:

.info-content {
	padding: 10px 0;
	margin: 0 16px;
	display: flex;
	.info-text {
		font-weight: 400;
		font-size: 14px;
		color: #919191;
		&:before {
			content: "";
			float: right;
			width: 0;
			height: calc(100% - 16px);
			background: red;
		}
		&.mle-hidden {
			display: -webkit-box;
			overflow: hidden;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 2;
		}
	    .show-all {
		    float: right;
		    clear: both;
		    font-weight: 500;
		    font-size: 14px;
		    color: #61afff;
		    cursor: pointer;
		    margin-top: -4px;
	        .arrow {
		        display: inline-block;
		        width: 6px;
		        height: 6px;
		        border-left: 2px solid #61afff;
		        border-bottom: 2px solid #61afff;
		        transform: translateY(-30%) rotate(-45deg);
		        margin: 0 4px;
		        transition: all ease-in-out 0.3s;
		        &.active {
			        transform: rotate(135deg);
		        }
	        }
        }
    }
}

最主要的是使用伪元素before把按钮顶下来,始终在最后一行

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值