Is there any way to reference device-height and device-width in your CSS in order to center a div containing dynamic content of varying sizes (images)? Is it possible to use JS to get the effective viewport dimensions and 开发者_运维百科then reference them with SASS/LESS, or am I dreaming?
Here's a simple example of how to get the viewport with JavaScript: http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/
But I would suggest looking into CSS Media Queries: Detect screen width with CSS Media Queries
精彩评论