Y
Hacker News
new
|
ask
|
show
|
jobs
by
thoughtpalette
4545 days 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.
1 comments
debt
4545 days ago
center a div both vertically and horizontally to the viewport; also it should stay center when resized.
link
thoughtpalette
4545 days ago
Absolute Horizontal And Vertical Centering In CSS
http://coding.smashingmagazine.com/2013/08/09/absolute-horiz...
link
debt
4545 days ago
Truth. The div would need a variable height though which would change the design.
link
proexploit
4545 days ago
The page linked includes techniques for both variable height content (e.g. translate -50%) and fixed content.
link
ptx
4545 days ago
Although this used to be a problem with CSS, it has been fixed in modern browsers:
http://philipwalton.github.io/solved-by-flexbox/demos/vertic...
link
pjmlp
4545 days ago
Now make it work across all browsers and operating systems required by your customer.
link
elclanrs
4545 days ago
You can use viewport units in modern browsers. See here
http://caniuse.com/viewport-units
link