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'> | <div class='qu'> | ||
<pre class='usr'> | <pre class='usr'> |
Revision as of 06:09, 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; } `;