<body onload="myFunction()" style="margin:0;height:850px">
How can I put @media queries in there? I tried in CSS but it does not work. I think it would be easier if I put it in the HTML body tag.
<body onload="myFunction()" style="margin:0;height:850px">
How can I put @media queries in there? I tried in CSS but it does not work. I think it would be easier if I put it in the HTML body tag.
To make @media
queries work you need to put a <meta>
viewport tag in the head, like this:
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
If you do that @media
queries should work in either a seporate CSS stylesheet or through <style>
tags.
https://developer.mozilla.org/en-US/docs/Web/HTML/Viewport_meta_tag
You can inline css styles by using the style
tag.
<body>
<style>
@media only screen and (max-width: 400px) {
.body {
background-color: red;
}
}
</style>
</body>