尊重形象';s位置,我需要将图像居中。I';我使用react和css

尊重形象';s位置,我需要将图像居中。I';我使用react和css,css,reactjs,Css,Reactjs,我想把我的形象居中,但我不知道怎么做。这是我的密码 text ={ fontWeight: 'bold' } screenColor ={ background: 'lightblue', height: 800, weight: 500 } render() { return( &l

我想把我的形象居中,但我不知道怎么做。这是我的密码

        text ={

           fontWeight: 'bold'

         }

        screenColor ={
         background: 'lightblue',
         height: 800,
         weight: 500
       }
        render() {
           return(
               <nav className="nav" style={{
                background: 'lightblue',
                height:800,
                weight:600,
                margin: '20 20 0 10',
                padding: '10 10 0 10'
                 }}  >
              <div className="container" style={this.screenColor}>


              <div style={this.text}>Welcome - Programming 3 2019 </div>

              <br></br>

           <img  src={net} style={{
            justifyContent: 'center',
            alignItems: 'center'}}   //These lines from img tag didn't work except src and alt.
             alt="fireSpot"/>


             </div>;
             </nav>
                 )
                   }
                   }
文本={
fontWeight:“粗体”
}
屏幕颜色={
背景:“浅蓝色”,
身高:800,
体重:500
}
render(){
返回(
欢迎光临-2019年3月3日


; ) } }
如何使图像居中?我需要解决这个问题。我想将图像居中。我正在使用react,但我需要将图像放在位置的中心


通过另一种方式,我希望将图像的高度降低。

在Div标记中添加ClassName。并以样式定义类

<div className="imgStyle">
  <img  src={net} style={{
            justifyContent: 'center',

            alignItems: 'center'}}   
             alt="fireSpot"/>
</div>

.imgStyle{ 
Display: flex;
Height: 100vh;
Width: 100vw; 
Align-Items: center;
Justify-Content: centre;
}



.imgStyle{
显示器:flex;
高度:100vh;
宽度:100vw;
对齐项目:居中;
内容:中心;
}

使用
文本对齐
来解决此问题。它不起作用。将该图像包装在div中,然后应用该图像