A.M.M
A.M.M

Reputation: 59

Show ads based on viewport width

I am working on a responsive design and would like to display a different ad only when the viewport width is less or equal to 480px.

I guess this can be done in jquery. Someone please help

Thanks

Upvotes: 0

Views: 229

Answers (1)

ohaal
ohaal

Reputation: 5268

Have a look at CSS media queries.

Relevant quote from the link:

A media query consists of a media type and zero or more expressions that check for the conditions of particular media features. Among the media features that can be used in media queries are ‘width’, ‘height’, and ‘color’. By using media queries, presentations can be tailored to a specific range of output devices without changing the content itself.

See browser support.

Upvotes: 1

Related Questions