I’m trying to use some CSS to solve a layout problem while displaying my website on PC. I’ve found a really simple solution, but now the element isn’t at the right place while visualizing the page on mobile. It would be great if the CSS I’ve inserted in my website only applies when the page is visualized on PC.
Any kind of solution? Thanks!
To create a section of CSS that should only be applied on screens of a certain size, you can use media queries. For example:
You’re also likely to want to put the below in your
<head>
element to make the zooming work as expected on a mobile site:I’d recommend reading this article for more details on the viewport meta tag.
If you want to solve your layout problem you should learn about media queries:
Wikipedia: