在网页设计中,经常会涉及到图片的使用,而对于这些图片的排版,使其在页面中剧中往往是一种美观的设计。在CSS中,我们可以使用以下方法来设置图片剧中。 首先,我们需要为图片设置一个外部容器,在该容器中设置
<div class="container"> <img src="example.jpg" alt="example"> </div> <br> <style> .container { display: flex; justify-content: center; align-items: center; } </style>
<p style="text-align: center;"> <img src="example.jpg" alt="example"> </p>
粉丝
0
关注
0
收藏
0