私がやろうとしているのは、ブログ投稿のタイトルをブログの説明のちょうど半分の幅にし、ブログの説明の幅の 50% に揃えることです。
これは私がJSで試したものです:
var post_title_width = document.getElementById("post_desciption").offsetWidth;
var post_title_width = post_description * 0.5;
document.getElementbyId("post_title").style.width = post_title_width;
HTML:
<div class="post">
<span class="post_title">This is a test title, testing some javascript...........</span><br>
<span class="post_description">Hello this is a test description right here, just to test some code im trying to do</span>
</div>
JavaScript をテストして効率的に使用する方法を学びたいので、CSS は使用していません。