CSS - Add border to all divs

div {
    border: 1px solid #000000;
}

I agree with @McAden's answer. Alternatively, you can use jquery to add the style on the fly:

<script type="text/javascript">
    $('div').css('border','1px solid #000');
</script>

As McAden was saying, you may want to specify which divs you want to style. Instead of adding a class to each div you may want to try an approach like this,

.theseDivs div{
    /*styles here*/
}

<div class="theseDivs">
    <div>Style applied here</div>
    <div>and here, </div>
</div>
<div>but not here</div>

For all elements

<style> * {
    border: 1px solid #000000;
}
</style>

Tags:

Html

Css