1

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?

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.