1
I’m trying to make my application run on smartphones, beyond the desktop standard. But I can’t get the media queries to work properly.
It’s only working until the size of the tablet screen. When I minimize the screen to the size of the smartphone doesn’t work.
My code:
/*dataTable*/
td.highlight {
background-color: whitesmoke !important;
}
/*Responsivo nos seguintes dispositivos: google chrome, tablets (paisagem e retrato), smartphone*/
@media only screen and (max-width: 1920px), (max-width: 1080px), (max-width: 100em){
body {
background-color: #b3b3e6;
}
/* ========================= PAGINA DE GERAR DSS ================================== */
#form_excel {
padding: 10px;
}
#title_scroll_box {
display: block;
}
.container {
scroll-snap-type: y mandatory;
/*faz com que os elementos fiquem dentro do scroll, independente se a lista
adiciona ou remove elementos. Os elementos carregados e mostrados a medida
que a barra de rolagem desce */
}
.nabvar {
background-color: #000080;
color: white;
margin-bottom: 1.5em;
font-weight: bold;
font-size: 20pt;
}
@font-face {
font-family: Drops;
src: url('../fonts/Drops.ttf');
}
.title_gerador_dss {
font-family: Drops;
font-size: 30pt;
}
#excel_file {
width: 40em;
padding: 2em;
border-radius: 13px;
background-color: white;
margin-bottom: 5em;
padding-bottom: 4em;
}
.data_form {
display: inline-block;
}
#options {
margin-bottom: 30em;
color: black;
background-color: black;
}
#gerar_dss {
display: inline-block;
margin-top: 3em;
margin-left: 15em;
margin-right: 1em;
}
.btn_bold {
font-family: sans-serif;
font-weight: bold;
}
#loading_icon {
visibility: hidden;
}
/* ============================= PAGINA DE HISTORICO ========================= */
#historico {
width: 40em;
height: 9em;
padding: 2em;
border-radius: 13px;
background-color: white;
margin-bottom: 5em;
text-align: center;
}
#historico-table {
border-style: hidden;
}
caption {
font-weight: bold;
font-size: 20pt;
font-family: serif;
}
.margin_btn_history {
margin-right: 0.5em;
}
/* ======================== MENSAGENS DE ERRO E SUCESSO ================================ */
#msg_error {
font-family: monospace;
font-weight: bold;
font-size: 15pt;
}
#process-success {
height: 6em;
font-family: monospace;
font-weight: bold;
font-size: 15pt;
height: 3.3em;
background-color: #32CD32;
}
.material-icons {
color: white;
font-weight: bold;
}
.bold {
color: black;
font-size: 16pt;
font-family: fantasy;
}
.toast-success {
background: green;
}
.toast-error {
background: red;
}
.div-scroll {
overflow: scroll;
height: 380px;
width: 380px;
position: relative;
}
.message {
width: 100%;
border: 1px solid;
padding: 10px;
font-size: 13pt;
border-radius: 5px;
}
.message-error {
border-color: #d32f2f;
background-color: #ef5350;
color: white;
}
.message-success {
border-color: #32CD32;
background-color: #00FF00;
color: white;
}
#messages-form {
display: none;
}
#process-error {
display: none;
}
#process-success {
display: none;
}
#process-loading {
display: none;
}
.center {
text-align: center;
}
/*Regra para a animacao*/
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
/*Classe que mostra a animacao 'spin'*/
.loader {
border: 16px solid #f3f3f3;
border-radius: 50%;
border-top: 16px solid #3498db;
width: 50px;
height: 50px;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
}
@media only screen and (max-width: 480px) {
#aplicacao {
max-width: 10em;
}
}
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Alerta DSS</title>
<link rel="stylesheet" href="resources/css/style.css" media="screen">
<link rel="stylesheet" href="resources/css/materialize.min.css">
<link rel="stylesheet" href="//cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<body>
<!-- GERARDOR DE ARQUIVO EXCEL (DADOS DE DSS) -->
<div id="aplicacao" class="container">
<div class="container" id="excel_file">
<!--MENSAGENS DE ERRO DO FORMULÁRIO-->
<div class="message message-error" id="messages-form">
<a class="right" href="#"><i id="close-message-form" class="material-icons">close</i></a>
<ul class="list-error" id="error-msg"></ul>
</div>
<!--MENSAGEM DE SUCESSO DA GERAÇÃO DE DSS-->
<div class="message message-error" id="process-error">
<a class="right" href="#"><i id="close-message-error" class="material-icons">close</i></a>
<span><h5>Não foi possível gerar o arquivo DSS.</h5></span>
</div>
<!--MENSAGENS DE ERRO DA GERAÇÃO DE DSS-->
<div class="message message-success " id="process-success">
<a class="right" href="#"><i id="close-message-success" class="material-icons">close</i></a>
<span><h5>DSS gerado com sucesso.</h5></span>
</div>
<form id="form_excel">
<!-- FORMULARIO PARA ESPECIFICAR OS DADOS QUE DEVERA CONSTAR NO ARQUIVO EXCEL GERADO -->
<p>
<label class="bold" for="inicio">Data Inicial </label>
<input type="date" id="inicio" required>
</p>
<p>
<label class="bold" for="fim">Data Final </label>
<input type="date" id="fim" required>
</p>
<p>
<label class="bold" for="nome_arquivo">Nome para o Arquivo (Sem a extensão .dss): </label>
<input type="text" id="nome_arquivo" required placeholder="Será o nome do arquivo .dss a ser gerado">
</p>
<p>
<label class="bold" for="observacao">Observação </label> - Opcional
<input type="text" id="observacao" placeholder="Será o nome do arquivo .dss a ser gerado">
</p>
<p> <label class="bold data_form" for="tipo">Tipo de Dado </label>
<select id="tipo" required>
<option value="" disabled selected>Escolha um tipo</option>
<option value="HORARIO">HORÁRIO</option>
<option value="DIARIO">DIÁRIO</option>
<option value="MEDIAS_PCD">MÉDIAS PCD</option>
<option value="CHUVA_ACUMULADA">CHUVA ACUMULADA</option>
</select>
</p>
<p id="title_tipos_dados"> <label class="bold">Selecione o(s) tipos de dados que deseja gerar:</label></p>
<p>
<label>
<input type="checkbox" id="chuva" class="filled-in" value="dss_chuva"/>
<span>CHUVA</span>
</label>
</p>
<p>
<label>
<input type="checkbox" id="cota" class="filled-in" value="dss_cota"/>
<span>COTA</span>
</label>
</p>
<p>
<label>
<input type="checkbox" id="vazao" class="filled-in" value="dss_vazao"/>
<span>VAZÃO</span>
</label>
</p>
</form>
<!-- LISTA SCROLL COM AS OPCOES DE ESTACAO -->
<form>
<p class="bold">Selecione a estação desejada:</p>
<section class="container div-scroll">
<section id="estacoes_sace">
</section>
<section id="estacoes_hidro">
</section>
</section>
<div class="center" id="process-loading">
<br>
<div class="preloader-wrapper small active">
<div class="spinner-layer spinner-blue-only">
<div class="circle-clipper left">
<div class="circle"></div>
</div>
<div class="gap-patch">
<div class="circle"></div>
</div>
<div class="circle-clipper right">
<div class="circle"></div>
</div>
</div>
</div>
</div>
<a href="#" id="gerar_dss" class="btn btn_bold">Gerar Dados</a>
</form>
</div>
</div>
</body>
</html>
What I’m doing wrong?
But what is not working?? What is the problem? How is it and how should it look??
– hugocsl
I edited the question.
– Laura Regina
Do you know that
@media only screen and (max-width: 1920px), (max-width: 1080px), (max-width: 100em){
will consider only the greatest measure, right?!– LipESprY
No, I thought I would consider all the measures I specified. So I need to separate the queries into different code blocks?
– Laura Regina
So I take it you don’t understand the basics of media queries. Although it is extensive, please consider reading: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/CSS_Media_queries
– LipESprY