2

I have div with elements inside it. All elements are perfectly aligned. But I need to scale this div to fir viewport. I use now css scale but it don't support pixels so I cant enter size in pixels.

enter image description here

I need it looks like this. This is scaled div but it scaled manualy by entering css values. So how can I scale div to fit the screen preserving all elements size.

Riggun
  • 195
  • 15
  • You could probably use percentages being your parent div 100% of the viewport and the remaining ones 20% with margins around. You would make it responsive to whatever viewport you are working on – Jorge Guerreiro Nov 10 '20 at 10:50
  • Could you show us your (minimal) code - the CSS and the relevant HTML? – A Haworth Nov 10 '20 at 10:51
  • there many ways to accomplish it. The question remains what you intent to do afterwards and how it should look afetrwards. Also what you wanna do with a possible overflow. CSS-Grid is one way, flex boxes another way. Just to mention the 2 methods to be your solution mostlikely. However you should also provide all necessary code you already have. – tacoshy Nov 10 '20 at 10:53

2 Answers2

0

Try to add this in the head of your html document, it should help:

<meta name="viewport" content="width=device-width, initial-scale=1.0">
François B.
  • 1,096
  • 7
  • 19
RicardoS3
  • 11
  • 4
-1

Did you try the vw unit? https://www.w3schools.com/cssref/css_units.asp

You could give a width to you container (and other elements like the text), similar to Font scaling based on width of container

fouarges
  • 24
  • 4