Я создал эту скрипту, поскольку вы можете видеть, что у меня есть веб-страница с двумя текстами, одна под другой. Он отлично работает на широких экранах, но когда я сжимаю веб-страницу - или запускаю веб-страницу на мобильном устройстве - это испорчено, как на этом снимке экрана:
Я думал о том, чтобы сделать это более восприимчивым, добавив мобильные запросы CSS, но затем в коде, который у меня есть:
@media (max-width: 545px) {
.outer{
width:100%;
height:330px;
top:0;
position:relative;
}
.inner1{
width:100%;
height:320px;
margin-bottom:0px;
}
.inner2{
width:100%;
height:330px;
margin-bottom:0px;
}
}
@media (max-width: 435px) {
.outer{
width:100%;
height:380px;
top:0;
position:relative;
}
.inner1{
width:100%;
height:370px;
margin-bottom:0px;
}
.inner2{
width:100%;
height:380px;
margin-bottom:0px;
}
}
@media (max-width: 378px) {
.outer{
width:100%;
height:460px;
top:0;
position:relative;
}
.inner1{
width:100%;
height:450px;
margin-bottom:0px;
}
.inner2{
width:100%;
height:460px;
margin-bottom:0px;
}
}
и т.д., поэтому множество значений для разных ширины экрана. Я подозреваю, что есть другой способ сделать это, самый отзывчивый способ, которым мне не нужно покрывать каждую ширину экрана отдельно в мобильном CSS... Можете ли вы дать мне подсказку, как я могу изменить свой код, чтобы он работал независимо на любой ширине устройства/экрана? Спасибо!