小程序中css布局
目标效果:
所需图片:
http://didong.ddgeyou.com/adv...
http://didong.ddgeyou.com/adv...
http://didong.ddgeyou.com/adv...
本人写的效果,有没有大神有更好的写法
ps:图片链接是后台获取的,这里为了方便演示换成了url,实际上是变量形式wxml:
<view class="sign">
<view class="sign_bigbg_box">
<image class="sign_bigbg" mode="widthFix" src="http://didong.ddgeyou.com/advertising/1562137802.png">
</image>
</view>
<view class="sign_circle">
<image mode="aspectFit" src="http://didong.ddgeyou.com/advertising/1562137794.png"></image>
<view>0</view>
</view>
<view class="sign_click">
<view>
sign in
</view>
<view class="sign_click_click">
<view class="sign_click_click_imgbox">
<image mode="aspectFill" src="http://didong.ddgeyou.com/advertising/1562137786.png"></image>
</view>
Click
</view>
</view>
</view>
wxss:
.sign{
position: relative;
}
.sign_bigbg_box{
width: 100%;
}
.sign_bigbg{
width: 100%;
height: calc(750rpx*148/688)
}
.sign_circle,.sign_circle view,.sign_click{
width: 100%;
position: absolute;
top: 50%;
transform: translateY(-50%);
}
.sign_circle view{
width: auto;
left: 50%;
transform: translate(-50%,-60%);
color: #ff810b;
}
.sign_circle image{
width: 100%;
padding:20rpx 0;
height: calc(750rpx\*148/688)
}
.sign_click{
padding: 0 40rpx;
color: white;
}
.sign_click_click{
width: 150rpx;
margin-top: 10rpx;
padding: 10rpx;
display: flex;
justify-content: space-around;
align-items: center;
background-color: #df5050;
border-radius: 50rpx;
overflow: hidden;
}
.sign_click_click_imgbox{
display: flex;
justify-content: center;
align-items: center;
background-color:white;
border-radius: 50rpx;
padding:6rpx;
width:34rpx;
height:34rpx;
}
.sign_click_click image{
width: 100%;
height: 100%;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论