What kind of problem is solved by using a div with height 0 and both border-top and border-bottom set as a border?

as shown in the following figure:

it feels like solving the problem of 1px line on retina screen. It can be that the border is all set to 2px. Ask for advice

link (opened on mobile)

Mar.24,2021

looked at the link you gave me and found this code

if(/Android (\d+\.\d+)/.test(navigator.userAgent)){
            var version = parseFloat(RegExp.$1);
            if(version>2.3){
                var phoneScale = parseInt(window.screen.width)/640;
                if(/MZ-M571C/.test(navigator.userAgent)){
                    document.write('<meta name="viewport" content="width=640, minimum-scale = 0.5, maximum-scale= 0.5">');
                }else if(/M571C/.test(navigator.userAgent)&&/LizhiFM/.test(navigator.userAgent)){
                    document.write('<meta name="viewport" content="width=640, minimum-scale = 0.5, maximum-scale= 0.5">');
                }else{
                    document.write('<meta name="viewport" content="width=640, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', target-densitydpi=device-dpi">');
                }
            }else{
                document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
            }
        }else{
            document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
        }
  1. the attribute of target-densitydpi is checked. Its function is to set how many real physical pixels are used to render 1px css pixels.

target-densitydpi
its function is to zoom, the same as we set minimum-scale,maximum-scale. And this attribute is not supported in higher versions of android, ntot support , so the code in the script tag above is written, below android 2.3, using target-densitydpi to scale, and higher versions using minimum-scale,maximum-scale to scale. In essence, it is used to solve the problem of 1px.

  1. Why set both border-top and border-bottom to 1px?

I'm not sure about this question. I'm here to talk nonsense about my understanding and guess.
because this code sets the width of viewport to 640px, usually, the screen width of the mobile terminal is within the range of 360px-414px, it is obvious that the width of this viewport will be larger than device-width, so the browser will zoom first. If the dpi ratio of the phone is 2, then the 1px is not equal to 2 physical pixels, but less than 2 physical pixels.
then set minimum-scale ='+ phoneScale +', maximum-scale ='+ phoneScale +'to zoom further according to the screen dpi. After zooming twice in this way, it is very likely that the line of the 1px has been scaled to less than 1 physical pixel to render. So you need to set up another border-bottom:1px solid-sharpfff to compensate.


I only found divider this, not the one you mentioned, this is just a dividing line.


Thank you @ BBQ only sweet potatoes , very detailed. This is indeed a solution to the 1px problem. I found this article: TAT.tennylv Mobile web adaptation weapon-rem , which is mentioned in the rem adaptation Advanced level

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea4ac9-46a39.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea4ac9-46a39.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?