【发布时间】:2022-02-11 06:33:08
【问题描述】:
我尝试将justify-content 设置为space-between,但这也不起作用。
Home.jsx
import '../App.css';
import './Home.css';
import pic from './portfolio-image.jpeg';
import React, { Component } from 'react';
function Home(){
return(
<div className='safe-area'>
<div id = 'home-container'>
<div id = 'home-text-container'>
<div id='home-head'>
Hi, I'm <Name>.
</div>
<div id = 'home-body'>
I am passionate about software and web development. I like solve interesting and new problems through my expertise in coding.
I like to work with React, Firebase, MongoDB, Express, Python and more.
</div>
</div>
<div id = 'image-social-container'>
<img src= {pic} />
</div>
</div>
</div>
);
}
export default Home;
主页.css
#home-container{
display: flex;
flex-flow: row wrap;
align-content: center;
justify-content: space-between;
height: 75vh;
margin-left: 2cm;
margin-right: 2cm;
background-color: black;
}
#home-text-container{
display: flex;
flex-direction: column;
width: 50%;
line-height: 40px;
}
#home-head{
font-family: 'Roboto', sans-serif;
font-size: 210%;
font-weight: 400;
color: #b8fff1;
}
#home-body{
font-family: 'Roboto', sans-serif;
font-size: 140%;
font-weight: 300;
color: #b8fff1;
}
#image-social-container{
display: flex;
flex-direction: column;
}
#image-social-container img{
width: 15%;
border-radius: 10%;
align-self: flex-end;
}
【问题讨论】:
-
如果你有一个基于网格布局的布局,你可能想要use CSS grid而不是flexbox。