When working on a recent project, I found that there was always a blank space below when referencing pictures, as shown in the figure below. <style> .img-box { border: 2px solid red; width: 550px; } </style> <div class="img-box"> <img src="./img.png" alt=""> </div> Later I found out that the reason is that the inline block elements will be aligned with the text baseline. To solve this problem is actually very simple, there are two main methods: 1. Add vertical-align: middle | top | bottom, etc. to the image. (Recommended) img { vertical-align: bottom; } 2. Convert the image to a block-level element display: block; (Converting block-level elements may affect your layout, so the first method is recommended) g { display: block; } Well, the problem is solved so simply. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. |
<<: Vue custom directive details
>>: MySQL data table partitioning strategy and advantages and disadvantages analysis
When I was looking at some CSS3 animation source ...
Table of contents forEach() (ES6) method map() (E...
Recently Microsoft released Windows Server 2016, ...
This article introduces the sample code of CSS pi...
Table of contents Create a Vite project Creating ...
Table of contents Write in front Business code us...
This article records the installation tutorial of...
1. Overview The so-called life cycle function is ...
Table of contents process Demo Mini Program Backe...
Table of contents Background Configuring DHCP Edi...
IE's conditional comments are a proprietary (...
Table of contents 1. Easy to read code 1. Unified...
When installing in MySQL 8.0.16, some errors may ...
Table of contents 1. Shared CommonModule 2. Share...
1. Download the MySQL jdbc driver (mysql-connecto...