user1814771
user1814771

Reputation: 89

How to modify appearance of HTML on window resize?

Very simply put I want to display a html table, when the window is larger than 900px, or so. How would I do so?

Upvotes: 0

Views: 55

Answers (2)

SLaks
SLaks

Reputation: 888185

You're looking for CSS media queries.

You can use a media query to hide the element on smaller viewports.

Upvotes: 6

idrumgood
idrumgood

Reputation: 4934

Two options, Media queries or javascript.

Media Query:

@media screen and (max-device-width: 900px) { ... }

Put your specific code to show it in that file.

Javascript:

if(document.width >= 900){ /*display content*/ }

In the JS case, you may need to attach an event listener for a window resize.

Upvotes: 2

Related Questions