Home > Web Front-end > H5 Tutorial > body text

How to fix gaps between pictures

小云云
Release: 2017-12-11 11:53:26
Original
3374 people have browsed it

In the h project, there are about 3px gaps between several img tags. The effect is very bad, so how to solve it? The editor below will share with you the perfect solution to the gaps between images in HTML5. Friends who need it can refer to it. I hope it can help everyone.

Recently working on an h5 project, I encountered a problem that I couldn’t figure out. There was a gap of about 3px between several img tags.

As shown in the picture:

How to fix gaps between pictures

Later, Baidu did some research and roughly understood the reason. It was because the browser regarded the element as a word, and the gap was still long after some aligned letters. A section (such as j, g) is reserved. I have also found several solutions, which are feasible for personal testing.

1. Set the font-size of the body to 0;

When doing this, remember to specify the font size for the element when writing p below.

2, write

  <img  src="assets/img/turntable/lucky-turntable_07.jpg" alt="How to fix gaps between pictures" >
    <img  src="assets/img/turntable/lucky-turntable_11.png"  alt="How to fix gaps between pictures" >
    <img  src="assets/img/turntable/lucky-turntable_08.jpg" alt="How to fix gaps between pictures" >
Copy after login

as

<img  src="assets/img/turntable/lucky-turntable_07.jpg" alt="How to fix gaps between pictures" ><img  src="assets/img/turntable/lucky-turntable_11.png" alt="How to fix gaps between pictures" ><img  src="assets/img/turntable/lucky-turntable_08.jpg" alt="How to fix gaps between pictures" >
Copy after login

that is Say, write the img tags on the same line, without spaces in the middle;

Have you learned this? Hurry up and give it a try.

Related recommendations:

How to use CSS to automatically scale the height of an image

How to insert an image into html

Detailed explanation of the use of css outer margin

The above is the detailed content of How to fix gaps between pictures. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!