How to make a template css can be call with specific condition?

I design start layout with width 320px, my target is mobile device first > tablet > desktop. I check in developer mode in chrome, iphone 6/7/8 give me different result whereas iphone 6/7/8 still a mobile device, same as galaxy s4. what i need to set same setting by type device?

<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
      body { margin: 0; }
      .container {
        width: 100%;
        height: 20px;
        background-color: gray;
      }
      
      .container > div {
        width: 320px;
        height: inherit;
        background-color: pink;
        margin: auto;
        font-size: 1em;
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div>
        Responsive By Type Devices
      </div>
    </div>
  </body>
</html>