Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html lang="en" class="rwd">
	<head>
		<meta charset="utf-8">
		<title>Conserver une version Desktop avec une version Mobile sur le m&#xEA;me site web</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<link rel="stylesheet" href="common.css" media="screen">
	</head>
	<body>
		<header>
			<div class="brand">
				
				<div class="logo component">
					<h3>Bruno Lesieur</h3>
				</div>

			</div>
			<div class="slogan">
				
				<div class="markdown component">
					<p>Statique ou Responsive ? Le 2 en 1 !</p>
				</div>

			</div>
			<div class="title">
				
				<div class="logo component">
					<h1>Conserver une version Desktop avec une version Mobile sur le m&#xEA;me site web</h1>
				</div>	

			</div>
			<nav class="main-nav">
				
				<div class="navigation component">
					<ul>
						<li><a href="http://blog.lesieur.name/conserver-une-version-desktop-avec-une-version-mobile-sur-le-meme-site-web/">Article explicatif</a></li>
						<li><a href="https://codepen.io/Haeresis/pen/aBmIj">Source du code</a></li>
						<li><a href="desktop-first_desktop-version.html">Version Desktop</a></li>
						<li><a href="desktop-first_mobile-version.html">Version Mobile</a></li>
						<li><a href="desktop-first_mobile-and-desktop-version.html">Version Desktop/Mobile</a></li>
					</ul>
				</div>		

			</nav>
		</header>
		<div class="content">
			<section class="overview">
				
				<div class="carousel component">
					<h1>&#xC0; propos</h1>
					<p>Cette exemple est expliqu&#xE9; dans l&apos;article suivant : <a href="http://blog.lesieur.name/conserver-une-version-desktop-avec-une-version-mobile-sur-le-meme-site-web/">Conserver une version Desktop avec une version Mobile sur le m&#xEA;me site web</a>.</p>
				</div>	

			</section>
			<nav class="anchor-nav">
				
				<div class="navigation component">
					<h2>Sommaire</h2>
					<ul>
						<li>
							<a href="#h1-title">D&#xE9;tails sur cet exemple</a>
							<ul>
								<li>
									<a href="#h2-title">Les versions</a>
									<ul>
										<li><a href="#h3-title-1">Mobile</a></li>
										<li><a href="#h3-title-2">Desktop</a></li>
										<li><a href="#h3-title-3">Mobile/Desktop</a></li>
									</ul>
								</li>
							</ul>
						</li>
					</ul>
				</div>

			</nav>
			<article class="main">
				<div class="article">

					<div class="markdown component">
						<header>
							<h1 id="h1-title">D&#xE9;tails sur cet exemple</h1>
							<p>Cette page est un exemple de site Responsive Web Design qui peut &#xEA;tre affich&#xE9; en version Desktop sur un(e) mobile/tablette.
						</p></header>

						<h2 id="h2-title">Les versions</h2>
						<p>Cette page existe en 3 versions, <a href="desktop-first_desktop-version.html">Version Desktop</a>, <a href="desktop-first_mobile-version.html">Version Mobile</a> et <a href="desktop-first_mobile-and-desktop-version.html">Version Desktop/Mobile</a>.</p>

						<h3 id="h3-title-1">Mobile</h3>
						<p>La Version Mobile est celle delivr&#xE9;e par d&#xE9;faut &#xE0; l&apos;arriv&#xE9; sur le site. En r&#xE9;alit&#xE9;, c&apos;est une version Responsive Web Design.</p>

						<h3 id="h3-title-2">Desktop</h3>
						<p>La Version Desktop est celle delivr&#xE9;e quand depuis un affichage plus petit que l&apos;affichage bureau, on demande l&apos;affichage bureau quelque soit la page.</p>

						<h3 id="h3-title-3">Mobile/Desktop</h3>
						<p>La version Mobile/Desktop est celle qui, sans rechargement de page, fait basculer le site du mode Responsive en mode Bureau.</p>

						<header>
							<footer>
								<p>Pour tester cet exemple :</p>
								<ul>
									<li>Si vous venez d&apos;un grand &#xE9;cran, pensez &#xE0; r&#xE9;tr&#xE9;cir la fen&#xEA;tre de votre navigateur pour faire appara&#xEE;tre en pied de page le lien de la version non Responsive.</li>
									<li>Si vous venez d&apos;un(e) mobile/tablette, cliquez juste sur le lien de pied de page.</li>
								</ul>
							</footer>
						</header>
					</div>

				</div>
				<ul class="step-list">
					<li class="step">

						<div class="markdown component">
							<h3>R&#xE9;tr&#xE9;cir</h3>
							<p>1. Observer ce qu&apos;il se passe quand la fen&#xEA;tre r&#xE9;tr&#xE9;ci.</p>
						</div>

					</li>
					<li class="step">
						
						<div class="markdown component">
							<h3>Changer de version</h3>
							<p>2. Cliquez sur le lien en pied de page pour changer de version.</p>
						</div>

					</li>
					<li class="step">
						
						<div class="markdown component">
							<h3>Re-changer de version</h3>
							<p>3. Cliquez de nouveau sur le lien en pied de page pour re-changer de version.</p>
						</div>

					</li>
				</ul>
			</article>
			<ul class="call-to-action-list">
				<li class="call-to-action">
					
					<div class="markdown component">
						<h2>Version Mobile</h2>
						<p><a href="desktop-first_mobile-version.html">Afficher la page de rendu mobile</a></p>
					</div>

				</li>
				<li class="call-to-action">
		
					<div class="markdown component">
						<h2>Version Desktop</h2>
						<p><a href="desktop-first_desktop-version.html">Afficher la page de rendu bureau</a></p>
					</div>			

				</li>
				<li class="call-to-action">
		
					<div class="markdown component">
						<h2>Version Mobile/Desktop</h2>
						<p><a href="desktop-first_mobile-and-desktop-version.html">Afficher la page de switch en live</a></p>
					</div>			

				</li>
			</ul>
		</div>
		<footer>
			<nav class="secondary-nav">
				
				<div class="navigation component">
					<ul>
						<li>
							<a href="http://www.haeresis.fr/#/me-contacter">Contactez-nous</a>
						</li>
					</ul>
				</div>

			</nav>
			<div class="legals">
				
				<div class="markdown component">
					<p>&#xA9;Tous droits non r&#xE9;serv&#xE9;s</p>
				</div>	

			</div>
			<div class="utils">
				
				<div class="markdown component">
					<p><a class="display-desktop" href="desktop-first_desktop-version.html">Afficher version Bureau</a></p>
					<p><a class="display-responsive" href="desktop-first_mobile-version.html">Afficher version Mobile/Tablette</a></p>
				</div>	

			</div>
		</footer>
		<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
		<script src="common.js"></script>
	</body>
</html>
              
            
!

CSS

              
                /*------------------------------------*\
    $SUMMARY
\*------------------------------------*/

/**
 * SUMMARY.................It's me !
 * RESET...................Same render for all browser.
 * TEST....................Some activable or desactivale CSS rules for debug.
 * GRID....................Grid base 12 columns.
 * ALIGNMENT...............Align content of colums.
 * VISTIBLE / HIDDEN.......Hide / Display colums.
 */





/*------------------------------------*\
    $RESET
\*------------------------------------*/

* {
    -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
            box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
}





/*------------------------------------*\
    $TEST
\*------------------------------------*/

.brand:before,
.slogan:before,
.title:before,
.main-nav:before,
.overview:before,
.anchor-nav:before,
.main:before,
.call-to-action:before,
.secondary-nav:before,
.legals:before,
.utils:before {
    width: 100%;
    display: inline-block;
}

.brand:before {
    content: "Brand";
    background-color: rgba(0, 0, 150, 0.5);
}
.slogan:before {
    content: "Slogan";
    background-color: rgba(150, 150, 0, 0.5);
}
.title:before {
    content: "Title";
    background-color: rgba(255, 0, 0, 0.2);
}
.main-nav:before {
    content: "Nav";
    background-color: rgba(0, 255, 0, 0.2);
}
.overview:before {
    content: "Overview";
    background-color: rgba(150, 0, 0, 0.5);
}
.anchor-nav:before {
    content: "Anchor nav";
    background-color: rgba(0, 0, 255, 0.2);
}
.main:before {
    content: "Main";
    background-color: rgba(255, 255, 0, 0.2);
}
.call-to-action:before {
    content: "Call to action";
    background-color: rgba(255, 0, 255, 0.2);
}
.secondary-nav:before {
    content: "Secondary nav";
    background-color: rgba(0, 150, 0, 0.5);
}
.legals:before {
    content: "Legals";
    background-color: rgba(0, 255, 255, 0.2);
}
.utils:before {
    content: "Utils";
    background-color: rgba(150, 0, 150, 0.5);
}
.main:before {
    content: none;
}
.article:before {
    content: "Article";
    background-color: rgba(255, 255, 0, 0.2);
    width: 100%;
    display: inline-block;
}
.step:before {
    content: "Step";
    background-color: rgba(0, 255, 0, 0.2);
    width: 100%;
    display: inline-block;
}





/*------------------------------------*\
    $GRID
\*------------------------------------*/

/*
.span12-12 { width: 100%; }
.span12-11 { width: 91.66666667%; }
.span12-10 { width: 83.33333333%; }
.span12-9 { width: 75%; }
.span12-8 { width: 66.66666667%; }
.span12-7 { width: 58.33333333%; }
.span12-6 { width: 50%; }
.span12-5 { width: 41.66666667%; }
.span12-4 { width: 33.33333333%; }
.span12-3 { width: 25%; }
.span12-2 { width: 16.66666667%; }
.span12-1 { width: 8.33333333%; }

.pull12-12 { right: 100%; }
.pull12-11 { right: 91.66666667%; }
.pull12-10 { right: 83.33333333%; }
.pull12-9 { right: 75%; }
.pull12-8 { right: 66.66666667%; }
.pull12-7 { right: 58.33333333%; }
.pull12-6 { right: 50%; }
.pull12-5 { right: 41.66666667%; }
.pull12-4 { right: 33.33333333%; }
.pull12-3 { right: 25%; }
.pull12-2 { right: 16.66666667%; }
.pull12-1 { right: 8.33333333%; }
.pull12-0 { right: 0; }

.push12-12 { left: 100%; }
.push12-11 { left: 91.66666667%; }
.push12-10 { left: 83.33333333%; }
.push12-9 { left: 75%; }
.push12-8 { left: 66.66666667%; }
.push12-7 { left: 58.33333333%; }
.push12-6 { left: 50%; }
.push12-5 { left: 41.66666667%; }
.push12-4 { left: 33.33333333%; }
.push12-3 { left: 25%; }
.push12-2 { left: 16.66666667%; }
.push12-1 { left: 8.33333333%; }
.push12-0 { left: 0; }

.prepend12-12 { margin-left: 100%; }
.prepend12-11 { margin-left: 91.66666667%; }
.prepend12-10 { margin-left: 83.33333333%; }
.prepend12-9 { margin-left: 75%; }
.prepend12-8 { margin-left: 66.66666667%; }
.prepend12-7 { margin-left: 58.33333333%; }
.prepend12-6 { margin-left: 50%; }
.prepend12-5 { margin-left: 41.66666667%; }
.prepend12-4 { margin-left: 33.33333333%; }
.prepend12-3 { margin-left: 25%; }
.prepend12-2 { margin-left: 16.66666667%; }
.prepend12-1 { margin-left: 8.33333333%; }
.prepend12-0 { margin-left: 0; }

.append12-12 { margin-right: 100%; }
.append12-11 { margin-right: 91.66666667%; }
.append12-10 { margin-right: 83.33333333%; }
.append12-9 { margin-right: 75%; }
.append12-8 { margin-right: 66.66666667%; }
.append12-7 { margin-right: 58.33333333%; }
.append12-6 { margin-right: 50%; }
.append12-5 { margin-right: 41.66666667%; }
.append12-4 { margin-right: 33.33333333%; }
.append12-3 { margin-right: 25%; }
.append12-2 { margin-right: 16.66666667%; }
.append12-1 { margin-right: 8.33333333%; }
.append12-0 { margin-right: 0; }

.pull-push { position: relative; }
.gutter { padding-left: 16px; padding-right: 16px; }
.pull-push-reset { position: static; }
.gutter-reset { padding-left: 0; padding-right: 0; }
.list-reset { margin: 0;padding: 0;list-style-type: none; }
.clearfix { clear: both; }
*/

body > header,
body > footer,
.content {
    margin-left:auto;
    margin-right:auto;
    width: 1200px;
}

    body > header:after,
    body > footer:after,
    .content:after,
.grid:after {
    content: "";
    clear: both;
    display: block;
}

/* Large desktop */
    .brand,
    .slogan,
    .title,
    .main-nav,
    .overview,
    .anchor-nav,
    .main,
    .article,
    .step,
    .call-to-action,
    .secondary-nav,
    .utils,
    .legals,
.columns {
    float: left;
    width: 100%;
}

    .brand,
    .slogan,
    .title,
    .main-nav,
    .overview,
    .anchor-nav,
    .article,
    .step,
    .call-to-action,
    .secondary-nav,
    .utils,
    .legals,
.gutter { padding-left: 16px; padding-right: 16px; }

    .step-list,
    .call-to-action-list,
.list-reset { margin: 0;padding: 0;list-style-type: none; }

    .title,
.clearfix { clear: both; }

    .brand,
.span12-2 { width: 16.66666667%; }
    .utils,
    .anchor-nav,
.span12-3 { width: 25%; }
    .main-nav,
    .step,
    .call-to-action,
.span12-4 { width: 33.33333333%; }
    .title,
.span12-8 { width: 66.66666666%; }
    .main,
    .legals,
.span12-9 { width: 75%; }
    .slogan,
.span12-10 { width: 83.33333333%; }

    .rwd .legals,
.span12-12 { width: 100%; }

    .call-to-action,
    .slogan,
    .brand,
.pull-push { position: relative; }

    .slogan,
.pull12-2 { right: 16.66666667%; }
    .brand,
.push12-10 { left: 83.33333333%; }

    .call-to-action:nth-child(odd),
.prepend12-2 { margin-left: 16.66666667%; }
    .call-to-action:nth-child(even),
.append12-2 { margin-right: 16.66666667%; }



/* Desktop */
@media (max-width: 1199px) {
.rwd body > header,
.rwd body > footer,
.rwd .content {
    max-width: 1200px;
    width: auto;
}

    .rwd .legals,
.span12-9 { width: 75%; }

    .rwd .call-to-action,
.pull-push-reset { position: static; }

    .rwd .call-to-action:nth-child(odd),
.prepend12-0 { margin-left: 0; }
    .rwd .call-to-action:nth-child(even),
.append12-0 { margin-right: 0; }
}



/* Tablet / Small desktop */
@media (max-width: 991px) {
    .rwd .call-to-action,
.span12-6 { width: 50%; }
}



/* Mobile / Small tablet */
@media (max-width: 761px) {
    .rwd .brand,
    .rwd .slogan,
    .rwd .title,
    .rwd .main-nav,
    .rwd .overview,
    .rwd .anchor-nav,
    .rwd .main,
    .rwd .article,
    .rwd .step,
    .rwd .call-to-action,
    .rwd .secondary-nav,
    .rwd .utils,
    .rwd .legals,
.columns {
    width: 100%;
}

    .rwd .brand,
    .rwd .slogan,
.pull-push-reset { position: static; }

    .rwd .brand,
.push12-0 { left: 0; }
    .rwd .slogan,
.pull12-0 { right: 0; }
}





/*------------------------------------*\
    $ALIGMENT
\*------------------------------------*/

/*
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }
*/

/* Large desktop */

    .utils,
    .brand,
.text-right { text-align: right; }



/* Mobile / Small tablet */
@media (max-width: 761px) {
    .rwd .brand,
.text-left { text-align: left; }

    .rwd .utils,
.text-center { text-align: center; }
}




  
/*------------------------------------*\
    $VISTIBLE / HIDDEN
\*------------------------------------*/

/*
.display-block, visible { display: block; }
.display-inline { display: inline-block; }
.display-inline-block { display: inline-block; }
...
.display-none, hidden { display: none; }
*/

/* Large desktop */

    .rwd .utils,
    .call-to-action:nth-child(n+3),
    .display-desktop,
    .rwd .display-responsive,
.display-none, hidden { display: none; }

    .rwd .display-desktop,
.display-block, visible { display: block; }



/* Desktop */
@media (max-width: 1199px) {
    .rwd .utils,
    .rwd .call-to-action:nth-child(n+3),
.display-block, visible { display: block; }
}



/* Tablet / Small desktop */
@media (max-width: 991px) {
    .rwd .call-to-action:nth-child(n+3),
.display-none, hidden { display: none; }
}



/* Mobile / Small tablet */
@media (max-width: 761px) {
    .rwd .step,
.display-none, hidden { display: none; }
}
              
            
!

JS

              
                $(".display-desktop").click(function (e) {
	e.preventDefault();
	$("html")
		.removeClass("rwd");
	$("meta[name=viewport]").attr('content','');
});
$(".display-responsive").click(function (e) {
	e.preventDefault();
	$("html")
		.addClass("rwd");
	$("meta[name=viewport]").attr('content','width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no');
});
              
            
!
999px

Console