Difference between revisions of "DOM div in div"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
<pre id='shellbody' data-qtp='DOM'></pre> | <pre id='shellbody' data-qtp='DOM'></pre> | ||
==A contains B== | |||
<div class='qu'> | |||
<pre class='usr'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
<pre class='ans'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
</div> | |||
==A contains B== | |||
<div class='qu'> | |||
<pre class='usr'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
<pre class='ans'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
</div> | |||
==A contains B== | |||
<div class='qu'> | |||
<pre class='usr'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
<pre class='ans'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
</div> | |||
==A contains B== | |||
<div class='qu'> | |||
<pre class='usr'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
<pre class='ans'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
</div> | |||
==A contains B== | |||
<div class='qu'> | |||
<pre class='usr'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
<pre class='ans'> | |||
let a = document.createElement('div'); | |||
a.innerHTML = 'A'; | |||
let b = document.createElement('div'); | |||
b.innerHTML = 'B'; | |||
document.body.append(a); | |||
a.append(b); | |||
let css = document.createElement('style'); | |||
document.head.append(css); | |||
css.innerText = ` | |||
div{ | |||
border:solid; | |||
padding: 1ex; | |||
margin: 1ex; | |||
} | |||
`;</pre> | |||
</div> | |||
==A contains B== | ==A contains B== | ||
<div class='qu'> | <div class='qu'> |
Revision as of 06:10, 11 September 2021
A contains B
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
A contains B
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
A contains B
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
A contains B
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
A contains B
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
A contains B
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;
let a = document.createElement('div'); a.innerHTML = 'A'; let b = document.createElement('div'); b.innerHTML = 'B'; document.body.append(a); a.append(b); let css = document.createElement('style'); document.head.append(css); css.innerText = ` div{ border:solid; padding: 1ex; margin: 1ex; } `;