CSS - Add border to all divs

Viewed 62155

I was wondering if there was any "easy" way to add through css lets say:

border: 1px solid red;

to all divs no matter what their id´s are.

I realize this might be a very very basic question (or no possible at all) and I hope it is clear enough.

Just to clarify, lets say I´ve got:

HTML

<div id="one">

</div>

<div id="two">

</div>

and CSS

#one{
height: 10px;
width: 10px;
}

#two{
height: 10px;
width: 10px;
}

The result I actually want is:

#one{

height: 10px;
width: 10px;
border: 1px solid red;
}

#two{
height: 10px;
width: 10px;
border: 1px solid red;
}

I want to achieve this without having to go one by one.

Thanks in advance!!

Please ask for any clarification needed!

8 Answers

Plain JavaScript:

const style = document.createElement('style');
style.innerHTML= "div {border: 1px solid #FF0000 !important};";
document.head.appendChild(style);
Related