【发布时间】:2019-07-23 16:16:57
【问题描述】:
我想创建一个个人资料页面,其中圆形图像将以 30:70 的比例位于两个 div 的顶部,其中顶部 div 将为空,底部 div 将包含少量项目。我尝试了一些来自网络的代码 sn-ps。
<View style={{ flex: 1, flexDirection: 'column', backgroundColor: 'green', justifyContent: 'flex-start', alignItems: 'flex-start' }}>
<View style={{ flexDirection: 'column', justifyContent: "flex-start", alignItems: "flex-start", alignSelf: "flex-start" }}>
{/* <View style={{ flex: 1, flexDirection: 'row', alignItems: 'flex-end', alignSelf: 'flex-start', margin: 1 }}> */}
<View style={{ backgroundColor: 'white', borderRadius: 10, flexDirection: 'column', height: "30%", width: "100%" }}></View>
{/* </View> */}
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'flex-start', alignSelf: 'flex-start', margin: 1 }}>
<View style={{ backgroundColor: 'white', borderRadius: 10, flexDirection: 'column', height: "70%", width: "100%" }}></View>
</View>
</View>
<View style={{ justifyContent: 'center', alignItems: 'center', alignSelf: 'center', position: 'absolute' }}>
<View style={{
backgroundColor: 'blue',
borderRadius: 10, height: 100, width: 100, borderRadius: 100 / 2
}}></View>
</View>
</View>
【问题讨论】:
-
我们需要输出 HTML 和 CSS——而不是你的反应代码。理想情况下在堆栈片段中。
-
适用于 React Native 还是 web?
-
@ash 检查我的回复,看看它是否适合你
标签: css react-native