Simple css question, why did you change your profession again?

I was learning a simple effect in front of the video, but I found a magical phenomenon. Sometimes elements automatically wrap.
link:
Code and effect

as shown in the figure

5bd2eac021e93.png

typecheckboxinput:

5bd2ea6c59fe4.png

my question is that each of these four input has a label tag wrapped around it, but I just set the width of the label tag to 110px, and the value of is not large . Why does break the line when can obviously be lined up ?

Code:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
  *{
    margin: 0;
    padding: 0;
  }
  .container{
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    text-align: center;
  }
  h1{
    margin-bottom: 40px;
    font-family: sans-serif;
  }
  .switch{
    position: relative;
    display: inline-block;
    width: 110px;
    height: 60px;
    margin: 0 10px;

  }
  
  </style>
</head>
<body>
 <div class="container">
   <h1>Toggle Switch</h1>
   <label  class="switch">
     <input type="checkbox">
        <span class="slider"></span>
   </label>
   <label  class="switch">
     <input type="checkbox" checked>
        <span class="slider"></span>
   </label>
   <label  class="switch">
     <input type="checkbox">
        <span class="slider"></span>
   </label>
   <label  class="switch">
     <input type="checkbox" checked>
        <span class="slider"></span>
   </label>
 </div> 
</body>
</html>
Sep.26,2021

transform: translate (- 50% maxim 50%); is offset from the current position and has no effect on the normal document stream. Remove it first.

at this time top: 50%; left: 50%; actually defines the position of the upper left corner of the .container container, that is, the upper left corner of the is always centered when the window changes

.container.container

transform: translate(-50%,-50%);.container2


containerswitchborder:1px solid;:

.

the actual width of container is only so much, and the inner width obviously exceeds to cause line wrapping (as shown above)
to solve this once and for all solution, add 100% width: to container;

may not be very clear

the above is a little more detailed, I may not go deep into the reason.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4bca4-44e75.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4bca4-44e75.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?