When I view it in the browser, I find that the graphics of div1
are obviously larger than div2
. If I change the css style of div2
, I will find that div:last-child{}
has no effect. I don't know what's going on, can someone help me?
* {
padding: 0;
margin: 0;
}
div {
width: 100px;
height: 100px;
background-color: pink;
}
div:first-child {
background-color: red;
padding: 10px;
}
div:last-child {
background-color: blue;
padding: 10px;
}
<div>1</div>
<div>2</div>
This is the screenshot: