Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can do that, but not right out of the box using css3 and html5 only! what you can do, even without relying on heavier frameworks, is to apply to various element's onload events and append a css class when the onload events are firing!</p> <p>lets say you make your body's css look like this :</p> <pre><code>body { opacity : 0; transition : opacity 1s ease; } .loaded { opacity : 1; } </code></pre> <p>you could then do something like this in javascript : </p> <pre><code>&lt;body onload="this.classList.add('loaded')"&gt; </code></pre> <p><strong>in some browsers the <code>this</code> variable within the body element is not really recognized, it's better to use document.body instead!</strong></p> <pre><code>&lt;body onload="document.body.classList.add('loaded')"&gt; </code></pre> <p>this gives you the freedom to play with various css properties all at once within css, <code>transform : all 1s ease;</code> without the hassle of learning new frameworks at all!</p> <p>Here's a working example </p> <pre><code>&lt;!doctype&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt; body { background: orange; -webkit-transition: all 1s ease; transition: all 1s ease; } .loaded { background: red; } &lt;/style&gt; &lt;script&gt;function loaded (el) { el.classList.add('loaded') }&lt;/script&gt; &lt;/head&gt; &lt;body onload="loaded(document.body)"&gt; Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Notice : This is, as requested, a html5/css3 solution! older browser may not support css <code>transitions</code> or the <code>classList</code> property!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload