rss
twitter
  • Showcase
  • Carrières
  • Support
  • GitLab
  • Espace client
  • Contact

Responsive CSS targetting

0

Voir aussi : spécifications du W3C sur les media queries CSS3

INDEX

Demo

C’est par là : https://italic.fr/test/responsive/

Markup

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>Responsive Design Test</title>

<!-- use the device's width and allow zooming -->
<meta name="viewport" content="width=device-width"/>

<!-- common styles such as css reset -->
<link rel="stylesheet" type="text/css" href="css/common.css" media="all" />

<!-- target iPhones -->
<link rel="stylesheet" href="css/smartphone.css" media="only screen and (min-device-width : 320px) and (max-device-width : 480px)">
<link rel="stylesheet" href="css/smartphone-landscape.css" media="only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : landscape)">
<link rel="stylesheet" href="css/smartphone-portrait.css" media="only screen and (min-device-width : 320px) and (max-device-width : 480px) and (orientation : portrait)">

<!-- target iPads -->
<link rel="stylesheet" href="css/tablet.css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px)">
<link rel="stylesheet" href="css/tablet-landscape.css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape)">
<link rel="stylesheet" href="css/tablet-portrait.css" media="only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : portrait)">

<!-- target retina displays no mather what type of device the user's browsing on -->
<link rel="stylesheet" href="css/retina.css" media="only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2)">
</head>
<body>

<h1 id="smartphone">Smartphone</h1>
<h1 id="tablet">Tablette</h1>
<h1 id="widescreen">Ordinateur</h1>

<h2 id="landscape">Paysage</h2>
<h2 id="portrait">Portrait</h2>

<h3 id="retina">Retina</h3>
<h4 id="normal"><strong>Non</strong> Retina</h3>
</body>
</html>

Common styles

html, body font-family: Arial; font-size:12px; 
h1 font-size:40px;
h2 font-size:30px;
h3 font-size:20px;
h4 font-size:14px;
#smartphone, #tablet, #portrait, #landscape, #retina display:none;

Macbook Pro

Smartphone styles

css/smartphone.css

#widescreen display:none;
#smartphone display:block;

Smartphone Landscape styles

css/smartphone-landscape.css

#landscape display:block;

iPhone 4 (landscape)

iPhone 3GS (landscape)

Smartphone Portrait styles

css/smartphone-portrait.css

#portrait display:block;

iPhone 3GS (portrait)

iPhone 4S (portrait)

Tablet styles

css/tablet.css

#widescreen display:none;
#tablet display:block;

Tablet Landscape styles

css/tablet-landscape.css

#landscape display:block;

 

iPad 2 (landscape)

iPad 3 (paysage)

Tablet Portrait styles

css/tablet-portrait.css

#portrait display:block;

 

iPad 2 (portrait)

iPad 3 (portrait)

Classic display styles

css/widescreen.css

#widescreen display:block;

 

MacBook Pro Retina

Android

L’hétérogénéité des appareils pose problème :

À moins de faire une version par type d’appareil, je ne vois pas de solution…

Émulateur ANDROID, WGA800, 400×800, 240dpi, landscape

L’inconvénient

À moins d’être très riche, ou d’habiter dans un Apple Store, c’est vraiment chiant à tester (i.e. : je suis allé à l’Apple Store).

À venir

Création, découpage, et inclusion d’images classiques / Retina avec Photoshop et les media queries CSS3.

DATE 19 Juin 2012
by : Germain
Author / Auteur

Social Share / Partager

    Leave a Reply / Répondre Annuler la réponse

    *
    *

    More in Front-end : HTML, CSS

    • Pense-bête Apache Server-Side Includes (SSI)
    • Chrome : émuler une CSS media print
    • Trucs et astuces Facebook : balises meta, open graph, dimensions...
    • Récupérer infos et vignettes d’une vidéo YouTube

    Search the blog

    Blog categories

    • Front-end : HTML, CSS (13)
    • Workflow (1)
    • Front-end : javascript, jQuery (33)
    • Back-end : PHP, CMS (42)
    • Back-end : SQL, MySQL (20)
    • Sysadmin : Linux, Apache, GIT (75)
    • Designers : tools, advice (2)
    • Desktop : OS X (37)
    • Desktop : Microsoft (12)
    • Uncategorized (8)

    ITALIC™ Resources

    • Paramètres de connexion au serveur mail
    • Graphistes : séduire un développeur web
    • Dév front : nos bonnes pratiques
    • Mailing : nos (bonnes ?) pratiques
    • Environnement de travail Mac

    Recent posts

    • Autoriser le chargement de contenus mixtes non-https dans Chrome (Mac)
    • Afficher les logs MySQL
    • Recevoir un mail lors de la connexion root à un serveur
    • Changer l’interclassement de plusieurs tables MySQL à la fois (ou presque
    • Maildev : tester l’envoi de mails durant ses développements
    © 2008-2017 ITALIC™ • 8 bis rue Abel • 75012 PARIS • Tel +33 (0)1 48 44 46 35 • RCS PARIS 508 228 772 • Powered by WordPress & GoodLayers
    Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site web.
    Cookie settingsACCEPTER
    Manage consent

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
    Necessary
    Toujours activé
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    Non-necessary
    Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
    Enregistrer & appliquer