issue with CSS media queries(scrollbar)

前端 未结 7 1484
别那么骄傲
别那么骄傲 2020-11-27 06:28

I am having problem with css media query in Firefox. It works correct in Chrome like I made two DIVs and want a scrollbar. If I decrease the screen size of firefox upto 800p

7条回答
  •  无人及你
    2020-11-27 06:50

    Firefox & Webkit based browsers render the scrollbar differently. In Firefox, MediaQuery considered width of scrollbar which is 15px with the screen width, but in Webkit based browsers it's not considered scrollbar with the screen width. So, that's why the floated DIVs are collapsed in Firefox.

    I did some stuff with css may be that's help you. (check this fiddle)

            html {
                /* force scrollbars */
                height: 101%;
            }
            body {
                margin: 0; 
                padding:0; 
                white-space:nowrap; 
            }  
            #box1,
            #box2 {
                display:inline-block;
                width: 400px;
                height: 200px;  
                vertical-align:top;
                white-space:normal;
            }
            #box1 {
                background: #ce0000;
                 margin-right:-5px;
            }
            #box2 {
                background: #8e0000;
            }
    
            @media screen and (max-width: 799px) { 
                body { 
                    white-space:normal; 
                }
                #box1,
                #box2 {
                    width: 300px;
                }
            }
    

提交回复
热议问题