<div>내용1</div>
<div>내용2</div>
<div>내용3</div>
* {
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
});
});
This Pen doesn't use any external CSS resources.