JavaScript
DOM , . , ( ), RSS- JavaScript , , CSS, JavaScript.
, div. div . HTML :
<article>
<h1>Blog Title</h1>
<div class="with-aside">
<p>My first paragraph...</p>
<aside>
<h3>Aside Heading</h3>
<p>Aside content...</p>
</aside>
</div>
<p>My second paragraph...</p>
</article>
JavaScript div. , . jQuery, :
$(function () {
$('.with-aside').each(function (i, e) {
var withAside = $(e);
var aside = withAside.find('aside');
aside.detach();
aside.prependTo(withAside);
aside.addClass('floating');
withAside.addClass('floating');
});
});
CSS . ( , ):
aside {
background-color: grey;
border: 1px solid black;
padding: 1em;
}
, JavaScript , :
aside {
margin: 0 5ex;
}
JavaScript. , :
aside.floating {
float: right;
clear: right;
width: 20em;
margin: 0 0 0 1ex;
}
div.with-aside:before {
content:"";
float: right;
width: 0;
height: 3.75em;
}
JavaScript , , , . , , width: 3px; background-color: green; div.with-aside:before, , .
@vals :before, .
source
share