Надеюсь, кто-нибудь может мне помочь.
Я пытаюсь разделить текст на 3 столбца на экране ноутбука, на 2 столбца для планшета и на 1 столбец для телефона.
Я использую приведенный ниже код, и он хорошо работает для 3 столбцов, но не работает отзывчивый бит, есть идеи, как это исправить?
.about находится внутри контейнера
Спасибо большое!!!
.container {
display: flex;
align-items: center;
}
.about {
columns: 3;
column-fill: balance-all;
column-gap: 1.5em;
padding: 2em 4em;
font: 1em/1.2 "special elite", serif;
hyphens: auto;
text-align: center;
color: black;
}
@media only screen and (max-width: 810px) {
.about {
columns: 2;
}
}
CSS, которым вы поделились, полностью в порядке, но я предпочитаю, чтобы вы пытались использовать количество столбцов вместо столбцов.
Спасибо
Почему-то не работает. не уверен, почему.
Я нашел ответ. Я добавил следующую строку в @media: height: max-content; и это сработало, как и ожидалось! Спасибо большое!!
Я добавил медиа-запрос для мобильных устройств и обновленный медиа-запрос для планшетов.
.container {
display: flex;
align-items: center;
}
.about {
columns: 3;
column-fill: balance-all;
column-gap: 1.5em;
padding: 2em 4em;
font: 1em/1.2 "special elite", serif;
hyphens: auto;
text-align: center;
color: black;
}
/*Tablet CSS*/
@media only screen and (max-width: 992px) {
.about {
columns: 2;
}
}
/*Mobile CSS*/
@media only screen and (max-width: 767px) {
.about {
columns: 1;
}
}
<div class = "about">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</div>
можете ли вы предоставить HTML, связанный с CSS, для создания минимальный воспроизводимый пример?