Chrome 调试页面会把 text-align 属性去掉 firefox 不会这样如何解决? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
woshichuanqilz

Chrome 调试页面会把 text-align 属性去掉 firefox 不会这样如何解决?

  •  
  •   woshichuanqilz Jan 27, 2023 1256 views
    This topic created in 1189 days ago, the information mentioned may be changed or developed.

    我在 chrome 里面调试, text-align 会被 user agent stylesheet 给去掉, 在匿名浏览页面也是这个情况, 但是在 firefox 里面 align 是可以的, 这个是为什么?

    代码 text-align center 在 btn span 里面

    css

    body{ min-height: 100vh; font-family: 'Poppins', sans-serif; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; background-color: black; } /* button */ .btn { width: 100px; height: 20px; border: none; position: relative; background-color: aqua; } .btn::after, .btn::before, .btn span::after, .btn span::before { transition: all 0.3s ease; } .btn span{ width: 100%; height: 100%; display: block; text-align: center; /* position: relative; */ } .btn::after, .btn::before { content: ""; /* bottom: 0; */ /* 修改这个就能影响生长方向 */ position: absolute; top: 0; right: 0; background-color: white; z-index: 2; } .btn span::after, .btn span::before { content: ""; position: absolute; /* top: 0; */ /* 修改这个就能影响生长方向 */ bottom: 0; left: 0; background-color: white; z-index: 2; } .btn::after, .btn span::after { width: 0%; height: 2px; } .btn::before, .btn span::before{ width: 2px; height: 0%; } .btn:hover::before, .btn span:hover::before{ height: 100%; } .btn:hover::after, .btn span:hover::after{ width: 100%; } 

    html

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" cOntent="IE=edge"> <meta name="viewport" cOntent="width=device-width, initial-scale=1.0"> <title>Document</title> <!-- style file --> <link rel="stylesheet" href="style.css"> </head> <body> <!-- button with a span in it --> <button class="btn"> <span>Ori</span> </button> </body> </html> 
    2 replies    2023-01-28 13:07:33 +08:00
    Rache1
        1
    Rache1  
       Jan 27, 2023
    检查你安装的插件
    dumbass
        2
    dumbass  
       Jan 28, 2023 via iPhone
    我注意到 edge 浏览器会在 css 调试栏里显示某个属性不生效标识及其原因,不知道是不是 chromium 系列浏览器会自动把无效属性去掉?
    About     Help     Advertise     Blog     API     FAQ     Solana     983 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 30ms UTC 23:03 PVG 07:03 LAX 16:03 JFK 19:03
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86