H
H
Herberito Galustyan2021-10-04 06:02:46
css
Herberito Galustyan, 2021-10-04 06:02:46

Why is LogoMonniMobile svg not rendered at 736px wide?

This is my code: codesandbox.io

CSS

@media (width > 736px) {
  #LogoMonni-mobile {
    display: none;
  }
}

@media (max-width <= 736px) {
  #LogoMonni-pc {
    display: none;
  }
  #LogoMonni-mobile {
    display: block;
  }
}

jsx

import { ReactComponent as LogoMonniPC } from "./logoMonniPC.svg";
import { ReactComponent as LogoMonniMobile } from "./LogoMonniMobile.svg";

import "./styles.css";

export default function App() {
  return (
    <div className={"LogoMonni"}>
      <LogoMonniPC />
      <LogoMonniMobile />
    </div>
  );
}

When the screen size is > 736px I show the desktop version of the SVG, and when <= 736px I show the mobile version but for some reason it doesn't show up on the screen. What is the reason and how to fix it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
smilingcheater, 2021-10-04
@smilingcheater

Because you are using incorrect media query syntax.
Instead of media (width > 736px) you need to write media (min-width: 737px)
Even the editor in codesandbox emphasizes this as an error for you.
Try reading the documentation https://developer.mozilla.org/ru/docs/Web/CSS/Medi...

A
Alexey Dubrovin, 2021-10-04
@alekcena

Google how to do media correctly?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question