Я попытался проверить свой файл css, но не нашел проблемы с изменением размера до размера планшета для макета сетки - PullRequest
0 голосов
/ 29 мая 2020

Извините, я новичок в HTML / CSS. У меня есть файл CSS, который, как мне кажется, работает, все работает, за исключением того, что я не могу понять, почему мое изменение размера с большого экрана на средний экран на маленький экран не работает. Он перескакивает с 3 ящиков подряд на 3 ящика в столбце. Я пытаюсь изменить размер среднего экрана на 2 меньших поля сверху и 1 большее поле внизу. Извините, если это плохой вопрос. Я отправлю свой файл css. Я не верю, что это файл HTML. Спасибо за помощь

      * {
  box-sizing: border-box;
}

h1 {
  color: black;
  text-align: center;
}

h2 {
  color: black;
  border: 1px solid black;
  float: right;
  position: relative;
  top: -26px;
  left: 21px;
  width: 150px;
}

section {
  color: black;
  text-align: center;
  background: grey;
  border: 1px solid black;
  height: 100%;
  width: 85%;
  font-family: sans-serif;
  padding: 5px 20px 5px 20px;
  margin-top: 5%;
  margin-left: 16px;
  position: relative;
}

p {
  position: relative;
  bottom: 30px;
  clear: right;
}

#Chicken {
  background-color: salmon;
}

#Beef {
  background-color: red;
}

#Sushi {
  background-color: green;
}

@media (min-width: 992px) {
  .col-lg-1,
  .col-lg-2,
  .col-lg-3,
  .col-lg-4,
  .col-lg-5,
  .col-lg-6,
  .col-lg-7,
  .col-lg-8,
  .col-lg-9,
  .col-lg-10,
  .col-lg-11,
  .col-lg-12 {
    float: left;
  }
  .col-lg-1 {
    width: 8.33%
  }
  .col-lg-2 {
    width: 16.66%
  }
  .col-lg-3 {
    width: 25%
  }
  .col-lg-4 {
    width: 33.33%
  }
  .col-lg-5 {
    width: 41.66%
  }
  .col-lg-6 {
    width: 50%
  }
  .col-lg-7 {
    width: 58.33%
  }
  .col-lg-8 {
    width: 66.66%
  }
  .col-lg-9 {
    width: 74.99%
  }
  .col-lg-10 {
    width: 83.33%
  }
  .col-lg-11 {
    width: 91.66%
  }
  .col-lg-12 {
    width: 100%
  }
  @media (min-width: 768px) and (max-width: 991px) {
    .col-md-1,
    .col-md-2,
    .col-md-3,
    .col-md-4,
    .col-md-5,
    .col-md-6,
    .col-md-7,
    .col-md-8,
    .col-md-9,
    .col-md-10,
    .col-md-11,
    .col-md-12 {
      float: left;
    }
    .col-md-1 {
      width: 8.33%
    }
    .col-md-2 {
      width: 16.66%
    }
    .col-md-3 {
      width: 25%
    }
    .col-md-4 {
      width: 33.33%
    }
    .col-md-5 {
      width: 41.66%
    }
    .col-md-6 {
      width: 50%
    }
    .col-md-7 {
      width: 58.33%
    }
    .col-md-8 {
      width: 66.66%
    }
    .col-md-9 {
      width: 74.99%
    }
    .col-md-10 {
      width: 83.33%
    }
    .col-md-11 {
      width: 91.66%
    }
    .col-md-12 {
      width: 100%
    }
    @media (max-width: 767px) {
      .col-sm-1,
      .col-sm-2,
      .col-sm-3,
      .col-sm-4,
      .col-sm-5,
      .col-sm-6,
      .col-sm-7,
      .col-sm-8,
      .col-sm-9,
      .col-sm-10,
      .col-sm-11,
      .col-sm-12 {
        float: left;
      }
      .col-sm-1 {
        width: 8.33%
      }
      .col-sm-2 {
        width: 16.66%
      }
      .col-sm-3 {
        width: 25%
      }
      .col-sm-4 {
        width: 33.33%
      }
      .col-sm-5 {
        width: 41.66%
      }
      .col-sm-6 {
        width: 50%
      }
      .col-sm-7 {
        width: 58.33%
      }
      .col-sm-8 {
        width: 66.66%
      }
      .col-sm-9 {
        width: 74.99%
      }
      .col-sm-10 {
        width: 83.33%
      }
      .col-sm-11 {
        width: 91.66%
      }
      .col-sm-12 {
        width: 100%
      }
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>module2-solution css</title>
</head>

<body>
  <h1>Our Menu</h1>
  <div class="col-lg-4 col-md-6 col-sm-12">
    <section>
      <h2 id="Chicken">Chicken</h2>
      <p>Heat the olive oil in a small, non-stick pan over medium heat. Crack the egg directly into the pan and season generously with salt and pepper. Cook for about two minutes, then use a spatula to flip the egg, being careful not to break the yolk. For
        a runny yolk, turn off the heat and let the egg sit for one minute.</p>
    </section>
  </div>
  <div class="col-lg-4 col-md-6 col-sm-12">
    <section>
      <h2 id="Beef">Beef</h2>
      <p>Heat the olive oil in a small, non-stick pan over medium heat. Crack the egg directly into the pan and season generously with salt and pepper. Cook for about two minutes, then use a spatula to flip the egg, being careful not to break the yolk. For
        a runny yolk, turn off the heat and let the egg sit for one minute.</p>
    </section>
  </div>
  <div class="col-lg-4 col-md-6 col-sm-12">
    <section>
      <h2 id="Sushi">Sushi</h2>
      <p>Heat the olive oil in a small, non-stick pan over medium heat. Crack the egg directly into the pan and season generously with salt and pepper. Cook for about two minutes, then use a spatula to flip the egg, being careful not to break the yolk. For
        a runny yolk, turn off the heat and let the egg sit for one minute.</p>
    </section>
  </div>
</body>

</html>

1 Ответ

0 голосов
/ 29 мая 2020

Думаю, было бы лучше, если бы вы использовали что-то под названием flexbox. Я использовал его раньше, но ничего не помню, кроме того, что это было здорово. На вашем месте я бы поискал для него синтаксис. (; -Человек на инте rnet

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...