Get HTML DOM with CSS
- by 2x2p1p
CSS can apply styles in elements through one ID, class or pseudo-selector, but I would like to get the HTML tree, something like in javascript:
<script type = "text/javascript">
    window.onload = function () {
        var div = document.getElementsByTagName ("div");
        div[0].style.backgroundColor = "gray";
        div[0].style.padding = "20px";
    }
</script>
So for example:
<style type = "text/css">
    div[0] { /* Wrong but i tried :( */
        background-color: gray;
        padding: 20px;
    }
</style>
<div >
    <div>...</div>
</div>
I'm tired of assign IDs to millions and millions of elements; is there a way to do this?