How to remove borders from img tag?

The img tag only sets the width and height, but does not set the src attribute. The picture has a border.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img{
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
    <img src="" alt="">
</body>
</html>

img picture:

Solution:

img:not([src]){
opacity:0;
}

 Using a negative pseudo-class selector in CSS and setting the transparency of the img without the src attribute to 0 can solve the problem of images with borders.

Guess you like

Origin blog.csdn.net/qq_41964720/article/details/131397016