<view class="content"> <image src="../../img/奶昔.png"></image> <view class="content-text">好友拼单</view> <view class="content-text2">呼朋唤友一起拼></view> </view> 为这段代码添加合适的样式,image在最左边,content-text在图片右边给他合适的间距,contenx-text2在content的右边
时间: 2023-12-04 21:06:22 浏览: 101
可以使用以下样式来实现:
```css
.content {
display: flex;
align-items: center;
justify-content: flex-start;
padding: 10px;
}
.content image {
width: 80px;
height: 80px;
margin-right: 20px;
}
.content-text {
font-size: 18px;
font-weight: bold;
margin-right: 20px;
}
.content-text2 {
font-size: 16px;
color: #999;
}
```
解释一下样式的含义:
- `.content`:使用 flex 布局,水平居中垂直居中对齐,设置 padding。
- `.content image`:设置图片的大小和右边距。
- `.content-text`:设置文本的样式和右边距。
- `.content-text2`:设置文本的样式和颜色。
相关问题
<view class="swiper"> <swiper class="banner" indicator-dots indicator-color="rgb(255, 255, 255, 0.5)" indicator-active-color="#fff" autoplay interval="3000" circular> <swiper-item class="bannerItem"> <image src="../../img/swiper01.png" mode="widthFix"></image> </swiper-item> <swiper-item class="bannerItem"> <image src="../../img/swiper02.png" mode="widthFix"></image> </swiper-item> <swiper-item class="bannerItem"> <image src="../../img/swiper03.png" mode="widthFix"></image> </swiper-item> <swiper-item class="bannerItem"> <image src="../../img/swiper04.png" mode="widthFix"></image> </swiper-item> </swiper> </view> <view class="box"> <view class="box1"> <image class="box-img" src="../../img/自取.png"></image> <view class="box-text">自取</view> <view class="box-text2">下单免排队</view> </view> <view class="box2"> <image class="box-img" src="../../img/外卖.png"></image> <view class="box-text">外卖</view> <view class="box-text2">甜蜜送到家</view> </view> </view> <view class="content"> <image src="../../img/奶昔.png"></image> <view class="content-text">好友拼单</view> <view class="content-text2">呼朋唤友一起拼></view> </view> <view class='bottom'> <view class='bottom-son'> <image src="../../img/隐藏新喝法.png"></image> <view class="bottom-son-text">隐藏新喝法</view> </view> <view class='bottom-son'> <image src="../../img/领10元券红包.png"></image> <view class="bottom-son-text">领10元券</view> </view> <view class='bottom-son'> <image src="../../img/0元兑周边.png"></image> <view class="bottom-son-text">0元兑周边</view> </view> </view> 为这个文件编写wxss
可以参考以下的样式代码:
```
.swiper {
height: 300rpx;
margin-bottom: 20rpx;
}
.bannerItem {
width: 100%;
height: 100%;
}
.bannerItem image {
width: 100%;
height: 100%;
}
.box {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 20rpx;
}
.box1, .box2 {
display: flex;
flex-direction: column;
align-items: center;
}
.box-img {
width: 80rpx;
height: 80rpx;
}
.box-text {
margin-top: 10rpx;
font-size: 32rpx;
font-weight: bold;
}
.box-text2 {
margin-top: 10rpx;
font-size: 28rpx;
color: #999;
}
.content {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 20rpx;
}
.content image {
width: 150rpx;
height: 150rpx;
margin-right: 20rpx;
}
.content-text {
font-size: 32rpx;
font-weight: bold;
}
.content-text2 {
margin-top: 10rpx;
font-size: 28rpx;
color: #999;
}
.bottom {
display: flex;
justify-content: space-between;
}
.bottom-son {
display: flex;
flex-direction: column;
align-items: center;
}
.bottom-son image {
width: 80rpx;
height: 80rpx;
}
.bottom-son-text {
margin-top: 10rpx;
font-size: 28rpx;
color: #999;
}
```
请注意,这只是其中的一种样式,具体样式需要根据您的需求和设计来进行调整。
阅读全文