/ / Wie style ich eine HTML-Datei mit zwei CSS-Dateien? - Javascript, HTML, CSS, Responsive-Design

Wie style ich eine HTML-Datei mit zwei CSS-Dateien? - Javascript, HTML, CSS, Responsive-Design

Ich muss zwei Versionen einer Web-App erstellen: eins für Landschaft und eins für Porträt. Aber ich muss diese beide ausführen, wie wir normalerweise in iPad tun; Im Hochformat sollte die Hochformatversion funktionieren und wenn der Modus Querformat ist, dann die Querformatversion.

Wie kann ich die Site mit einer HTML-Datei und zwei CSS-Dateien erstellen?

Antworten:

5 für die Antwort № 1

Verwenden Sie die Medienabfrage css3

/* iPads (landscape) */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}

2 für die Antwort № 2

Schau in responsives Design. Das Bootstrap-Projekt von Twitter enthält eine Reihe reaktionsfähiger Layouts, aber die Methode ist ziemlich einfach: Sie definieren Ihr CSS basierend auf der aktuellen Breite des Geräts.

http://twitter.github.com/bootstrap/scaffolding.html#responsive

Hier ein Artikel, der CSS3 und Medienabfragen erklärt: http://webdesignerwall.com/tutorials/responsive-design-with-css3-media-queries


1 für die Antwort № 3

Hier sind die css media queries für Standardgeräte: -

/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

0 für die Antwort № 4

Dieser wird dir helfen

http://ajaxian.com/archives/iphone-windowonorientationchange-code

Es erkennt die Orientierungsänderung Ihres Browsers und ruft die Java-Skript Funktion. Innerhalb der Funktion können Sie Ihre laden CSS-Klasse als deine Vorliebe :)