Home > Web Front-end > HTML Tutorial > Problem setting border width_html/css_WEB-ITnose

Problem setting border width_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:00:42
Original
1607 people have browsed it

When you start setting the border width of the div to 1px, the page that appears is like this

Then the mouse slides over the border and the width becomes 2px



But if you start If the border width is set to 2px, the above situation will not occur. May I ask why the above situation occurs?


Reply to the discussion (solution)

Height, etc., all have an impact

The height occupied by an element is equal to the sum of the set height attribute, padding, and border width (lower versions of IE calculate it differently).

If the width of the border changes, the height of the element will change.

So it will affect the layout of the entire page.

Who is this sister? Let me introduce you

Usually I will put a div outside and set the border width, but the color is transparent
Just give me a color when you mouse over it

The advantage is that the entire width is fixed

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