Skip to content

Fix 26970 #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
251 changes: 127 additions & 124 deletions flexbox/use-cases/media-flipped.html
Original file line number Diff line number Diff line change
@@ -1,105 +1,107 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Use cases: media objects</title>

<style>
body {
font: 1.2em Helvetica, Arial, sans-serif;
margin: 20px;
padding: 0;
}

textarea {
font-family: monospace;
display: block;
margin-bottom: 10px;
background-color: #F4F7F8;
border: none;
border-left: 6px solid #558ABB;
color: #4D4E53;
width: 90%;
max-width: 700px;
padding: 10px 10px 0px;
font-size: 90%;
}

textarea:nth-of-type(1) {
height: 250px
}

textarea:nth-of-type(2) {
height: 180px
}

.playable-buttons {
text-align: right;
width: 90%;
max-width: 700px;
padding: 5px 10px 5px 26px;
font-size: 100%;
}

section {
width: 90%;
max-width: 700px;
border: 1px solid #4D4E53;
border-radius: 2px;
padding: 10px 14px 10px 10px;
margin-bottom: 10px;
}

section input {
display: block;
margin: 5px;
}

img {
max-width: 100%;
}

.media {
width: 500px;
border: 2px dotted rgb(96, 139, 168);
}

.media img {
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Use cases: media objects</title>

<style>
body {
font: 1.2em Helvetica, Arial, sans-serif;
margin: 20px;
padding: 0;
}

textarea {
font-family: monospace;
display: block;
margin-bottom: 10px;
background-color: #f4f7f8;
border: none;
border-left: 6px solid #558abb;
color: #4d4e53;
width: 90%;
max-width: 700px;
padding: 10px 10px 0px;
font-size: 90%;
}

textarea:nth-of-type(1) {
height: 310px;
}

textarea:nth-of-type(2) {
height: 180px;
}

.playable-buttons {
text-align: right;
width: 90%;
max-width: 700px;
padding: 5px 10px 5px 26px;
font-size: 100%;
}

section {
width: 90%;
max-width: 700px;
border: 1px solid #4d4e53;
border-radius: 2px;
padding: 10px 14px 10px 10px;
margin-bottom: 10px;
}

section input {
display: block;
margin: 5px;
}

.media {
width: 500px;
border: 2px dotted rgb(96, 139, 168);
}

.media img {
margin: 0 10px 0 0;
}
}

.media.flipped img {
.media.flipped img {
margin: 0 0 0 10px;
}



</style>
<style class="editable">
.media {
display: flex;
align-items: flex-start;
}
.media.flipped {
}
</style>
<style class="editable">
img {
max-width: 100%;
}
.media {
display: flex;
align-items: flex-start;
}
.media.flipped {
flex-direction: row-reverse;
}
.media .content {
}
.media .content {
flex: 1;
padding: 10px;
}
</style>
</head>

<body>
<section>
<div class="media flipped">
<div class="image"><img src="MDN.svg" alt="MDN logo"></div>
<div class="content">This is the content of my media object. Items directly inside the flex container will be aligned to flex-start.</div>
</div>
}
</style>
</head>

<body>
<section>
<div class="media flipped">
<div class="image"><img src="MDN.svg" alt="MDN logo" /></div>
<div class="content">
This is the content of my media object. Items directly inside the flex
container will be aligned to flex-start.
</div>
</div>
</section>
<textarea class="playable-css">
img {
max-width: 100%;
}

</section>
<textarea class="playable-css">
.media {
display: flex;
align-items: flex-start;
Expand All @@ -113,40 +115,41 @@
flex: 1;
padding: 10px;
}
</textarea>
<textarea id="code" class="playable-html">
</textarea
>
<textarea id="code" class="playable-html">
<div class="media flipped">
<div class="image"><img src="MDN.svg" alt="MDN logo"></div>
<div class="content">This is the content of my media object. Items directly inside the flex container will be aligned to flex-start.</div>
</div>
</textarea>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset">
</div>
</body>
<script>
var section = document.querySelector('section');
var editable = document.querySelector('.editable');
var textareaHTML = document.querySelector('.playable-html');
var textareaCSS = document.querySelector('.playable-css');
var reset = document.getElementById('reset');
var htmlCode = textareaHTML.value;
var cssCode = textareaCSS.value;

function fillCode() {
editable.innerHTML = textareaCSS.value;
section.innerHTML = textareaHTML.value;
}

reset.addEventListener('click', function () {
textareaHTML.value = htmlCode;
textareaCSS.value = cssCode;
fillCode();
});

textareaHTML.addEventListener('input', fillCode);
textareaCSS.addEventListener('input', fillCode);
window.addEventListener('load', fillCode);
</script>
</textarea
>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset" />
</div>
</body>
<script>
var section = document.querySelector("section");
var editable = document.querySelector(".editable");
var textareaHTML = document.querySelector(".playable-html");
var textareaCSS = document.querySelector(".playable-css");
var reset = document.getElementById("reset");
var htmlCode = textareaHTML.value;
var cssCode = textareaCSS.value;

function fillCode() {
editable.innerHTML = textareaCSS.value;
section.innerHTML = textareaHTML.value;
}

reset.addEventListener("click", function () {
textareaHTML.value = htmlCode;
textareaCSS.value = cssCode;
fillCode();
});

textareaHTML.addEventListener("input", fillCode);
textareaCSS.addEventListener("input", fillCode);
window.addEventListener("load", fillCode);
</script>
</html>
Loading