Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem that adding a frame to a multi-line picture hover will squeeze the following picture somewhere else?

Shulou Source: shulou.com Published: 2022-06-03 08:40:02 09月29日 Update

This article mainly explains "how to solve the problem that multi-line picture hover plus border will squeeze the following pictures elsewhere." Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how to solve the problem that multi-line picture hover plus border will squeeze the following pictures elsewhere"!

Question:

When you encounter images arranged in multiple rows and columns, adding a border to the hover will squeeze the images below into other places.

============================================================

Note:

IE11 The following browsers load images with a 1px border by default

Solution: Set border:none for pictures

=============================================================

Hover border solution:

Originally:

The code is as follows:

1. Set transparent borders for elements (recommended):

The code is as follows:

li{

border:2px solid transparent;

}

li:hover{

border:2px solid red;

}

2. Wrap an element with a div

After change:

The code is as follows:

Style:

The code is as follows:

li{

wdith:468px;

}

div{

width:468px;

margin:2px;

padding:10px;

background-color:#fff;

}

div :hover{

margin:0;

border:2px solid red;

}

In addition:

Outlines IE 7 and 8 are not supported.

But it is displayed above the element without bounding it. Regardless of IE compatibility, you can directly replace border with outline.

At this point, I believe everyone has a deeper understanding of "how to solve the problem that the hover of multi-line pictures and the border will squeeze the following pictures elsewhere." It is advisable to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Tags: Picture border question face multi-line code element content method learning practical deeper interest package practicality practical simple operation solution more friends Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Tech Info macOS Redmi Microsoft