CSS-如何设置div背景图
文章目录
如何设置div背景图
给组件添加背景图控制只需要两步:
<View
className="gifts"
style={{
background: `url(${baseUrl}starMove/exclusiveEntrance/card.png) no-repeat`,
backgroundSize: '100% 100%',
}}
>
<View classname="gift-lists"></View>
</View>
设置background和backgroundSize。
style={
width:100%;
height:100%;
}
div如何居中:
- margin:0 auto;
- 行内元素的垂直居中把height和line-height的值设置成一样的即可。
文本居中:
text-align:center;
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论