CSS - overwrite style

0 points
Created by:

In this article, we would like to show you how to overwrite style in CSS.

Quick solution:

div {
  background: blue;  /* common style */

Use inline style to overwrite the common style: 

<div style="background: orange;">Background changed.</div>


Practical example

In this example, we use the inline style to overwrite the div element's background color.

// ONLINE-RUNNER:browser;

<!doctype html>

    body {
      display: flex;

    div {
      height: 75px;
      width: 75px;
      text-align: center;
      background: deepskyblue;
      border: 1px solid black;

  <div style="background: orange;">div-3</div>
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂