user12419272
user12419272

Reputation:

left and right border appears when i fit my svg in window

html, body { margin:0; padding:0;}
svg {top:0; left:0; height:100%; width:100% }
#b_txt{
    position:absolute;
    top: 500px;
    left:300px;
}

This b_txt is just a input box in html.

My svg is appearing that way

what can i do to fit?

Upvotes: 1

Views: 224

Answers (1)

Anurag
Anurag

Reputation: 307

If this case the ratio of height and width of your svg is fixed and you are trying to change the default height and width ratio which is not possible in your case.

If you put

svg{
    top:0; left:0; height:100%; width:100% 
}

It is setting height to 100% but ```width: 100%`` do not work, it automatically set width according to default svg ratio.

To fit the svg to screen change the default svg height and width according to your screen. or use only width: 100% but this will create height more than your screen.

Upvotes: 1

Related Questions