The scroll bar also appears when setting the overflow property without exceeding it.

problem description

when the parent DIV sets the overflow:auto property, the width and height of the child node svg are all the same, and a scroll bar appears

the environmental background of the problems and what methods you have tried

set margin padding to 0 and have an effect

related codes

/ / Please paste the code text below (do not replace the code with pictures)

< H1 > D1 {< / H1 >
            width: 800px; height: 600px;
            border: 1px solid black;
            overflow: auto;
            margin: 0;padding: 0;
        }
        
        -sharpsvgcontent{
            width: 800px;height: 600px;
            background: url(D:/doc/images/cat1.jpg);
            background-repeat:no-repeat;
            background-size: cover;
        }

D1 is the parent DIV. The one below is the subset node

.

what result do you expect? What is the error message actually seen?

I hope the scroll bar does not appear when the width and height of the two elements are the same, and the width or height of the internal SVG is greater than DIV.
now there is a scroll bar

Mar.31,2021

whether the parent container has given box-sizing: border-box a scroll bar will appear because you have added a border

Menu