CSS meta

  • Creatore Discussione Creatore Discussione Ikon
  • Data di inizio Data di inizio

Ikon

Utente Attivo
3 Dic 2021
51
1
8
Non mi funziona un meta inserito per telefonino, ma non ho capito l'errore, lascio lo script del CSS metà

@media only screen and (max-width:600px)
{
.slidedown {
height: 1020px;
}
}
Non mi prede il codice meta
 
Probabilmente manca il tag viewport nel meta. Senza quello, le media query come max-width:600px non vengono applicate correttamente su mobile.
 
First of all, the code you wrote is a CSS media query , not a meta tag. This is correct:



@media only screen and (max-width:600px) {
.slidedown {
height: 1020px;
}
}


As for the “mobile meta,” that goes in the <head> tag of your HTML , not in the CSS:




<meta name="viewport" content="width=device-width, initial-scale=1.0">



Without this meta tag, mobile browsers don't handle page scaling well, and media queries may appear to break.


Common issues to check:​


  • The CSS file is correctly linked to the HTML
  • The .slidedown class actually exists in your HTML
  • There are no other CSS styles that override this one.

In short:​


  • Meta tag = controls mobile display (HTML)
  • Media query = manages responsive styling (CSS)

If you add the meta viewport, mobile responsiveness should work fine.
 

Discussioni simili

M
Risposte
0
Visite
1K
HTML e CSS
Membro cancellato 49667
M