<body>
  <div>내용1</div>
  <div>내용2</div>
  <div>내용3</div>
</body>
* {
  margin: 0;
  padding: 0;
}

div:nth-child(1) {
  background: red;
}

div:nth-child(2) {
  background: green;
}

div:nth-child(3) {
  background: blue;
}
$(document).ready(function () {
  $("div").eq(0).css({ padding: 10, "text-align": "center" });
  $("div").css("width", function (index) {
    return index * 100 + 100; // 100, 200, 300
  });
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.1/jquery.min.js