![](/img/trans.png)
[英]How can I center my icons in the middle of the page and place the text under the icons?
[英]How can i center icons along with my text/paragraph in react?
我怎樣才能讓我的圖標像<GrTools size="30px"/>
和我的文字一樣居中? 我的一些樣式居中組件有點問題。
我的 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>
我的 css 文件:
div#paragraph{
width: 100%;
margin: 0px auto;
}
p#content{
text-align: center;
width: 100%;
margin: 50px auto;
}
display:flex
在容器上對齊子元素(icon & p)注意:將
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.