简体   繁体   English

我如何在反应中将图标与我的文本/段落一起居中?

[英]How can i center icons along with my text/paragraph in react?

How can i center my icons like <GrTools size="30px"/> along with my text?我怎样才能让我的图标像<GrTools size="30px"/>和我的文字一样居中? I am kind of having issues with some of my styled centering components.我的一些样式居中组件有点问题。

my js:我的 js:

<div id = 'paragraph' className="container" >
          <h1 className='text-center' > Title <b>  </b>  </h1>    
          <p id='content' className='lead mb-4'> paragraph</p>
          <hr className='col-xs-12 '/>
          <p id='content' className='lead mb-4'> paragraph</p>
            <GrTechnology className = 'responsive-image' size='30px'/>
          <p id='content' className='lead mb-4'> Paragraph</p>
            <GrTools size="30px"/>
          <p id='content' className='lead mb-4'> Paragraph</p>
</div>

my css file:我的 css 文件:

div#paragraph{

  width: 100%;
  margin: 0px auto;
}
p#content{
  text-align: center;
  width: 100%;
  margin: 50px auto;
}

note: change the class to className注意:将class更改为className

 .container{ display: flex; }
 <div id='paragraph' > <h1 className='text-center'> Title <b> </b> </h1> <p id='content' className='lead mb-4'> paragraph</p> <hr className='col-xs-12 ' /> <div class="container"> <p id='content' className='lead mb-4'> paragraph</p> <img src="https://img.icons8.com/ios-glyphs/30/000000/cat--v1.png" width='30px' /> </div> <div class="container"> <img src="https://img.icons8.com/ios-glyphs/30/000000/cat--v1.png" width='30px' /> <p id='content' className='lead mb-4'> paragraph</p> </div> <p id='content' className='lead mb-4'> Paragraph</p> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM