Home > Web Front-end > CSS Tutorial > How to remove img default interval in css

How to remove img default interval in css

WBOY
Release: 2021-12-13 09:25:40
Original
2557 people have browsed it

In CSS, you can use the "font-size" attribute to remove the default spacing of the img element. This attribute is used to set the font size within the element. When the value of the img parent element attribute is "0" , the default spacing of the img element within the element will be removed, and the syntax is "img parent element {font-size:0;}".

How to remove img default interval in css

The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.

How to remove the default spacing of img in css

In css, the img element will have a default spacing. An example is as follows:

How to remove img default interval in css

To solve the problem of default spacing in the middle, we can use the font-size attribute to eliminate the default spacing in the middle. First we need to place the img image in In the same div element, and then add the "font-size:0" style to the div element, you can eliminate the default spacing of the img element in the div element.

The example is as follows:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    div{
        font-size:0;
    }
    </style>
</head>
<body>
    <div>
    <img src="1118.How to remove img default interval in css" alt="">
    <img src="1118.How to remove img default interval in css" alt="">
    </div>
</body>
</html>
Copy after login

Output result:

How to remove img default interval in css

##(Learning video sharing:

css video tutorial

The above is the detailed content of How to remove img default interval in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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