3

Is there any difference between visibility: hidden and transform: scale(0,0)? Both give same results?

Thili77
  • 1,061
  • 12
  • 20
  • Yes, but the differences only matter in certain contexts. There isn't enough information in your question to tell which, if any, are relevant. – Quentin Jul 04 '17 at 13:19
  • 1
    Transform literally reshapes the element, here is what the other common methods for hiding an element do https://stackoverflow.com/questions/272360/does-opacity0-have-exactly-the-same-effect-as-visibilityhidden/273076#273076 – Andrew Bone Jul 04 '17 at 14:01

2 Answers2

4

If you set the visibility of an element to hidden it is hidden but still takes up space.

If you set the visiblity to collapse it will not take up space and will behave the same as display:none. But collapse can only be used on table elements.

transform: scale(0,0) will just set the size to 0,0 meaning css properties like float or clear will still take affect on other elements.

NtFreX
  • 10,379
  • 2
  • 43
  • 63
0

Yes they both work same

Visiblity: hidden The element is invisible (but still takes up space).

transform: scale(0,0) It will changes the appearance visually; the actual dimensions of the original object are maintained.

Nirav Joshi
  • 2,924
  • 1
  • 23
  • 45