3 ms·
"Nine out of ten times I want to do something with CSS I prefer doing it with JavaScript" You're doing something wrong then.
by thoughtpalette 13y ago
"Nine out of ten times I want to do something with CSS I prefer doing it with JavaScript"
You're doing something wrong then.
- debt 13y agocenter a div both vertically and horizontally to the viewport; also it should stay center when resized.
- thoughtpalette 13y agoAbsolute Horizontal And Vertical Centering In CSS http://coding.smashingmagazine.com/2013/08/09/absolute-horizontal-vertical-centering-css/ http://coding.smashingmagazine.com/2013/08/09/absolute-horiz...
- debt 13y agoTruth. The div would need a variable height though which would change the design.
- proexploit 13y agoThe page linked includes techniques for both variable height content (e.g. translate -50%) and fixed content.
- deleted 13y ago[deleted]
- ptx 13y agoAlthough this used to be a problem with CSS, it has been fixed in modern browsers: http://philipwalton.github.io/solved-by-flexbox/demos/vertical-centering/ http://philipwalton.github.io/solved-by-flexbox/demos/vertic...
- pjmlp 13y agoNow make it work across all browsers and operating systems required by your customer.
- elclanrs 13y agoYou can use viewport units in modern browsers. See here http://caniuse.com/viewport-units http://caniuse.com/viewport-units