html:
<div class="main_block">
<div class="block">
<p>some title</p>
<img src="some_image.png" />
</div>
<div class="block">
<p>some title</p>
<img src="some_image.png" />
</div>
<div class="block">
<p>some title</p>
<img src="some_image.png" />
</div>
</div>
CSS:
div.main_block
{
width: 600px;
}
div.main_block div.block
{
width: 100px;
margin-left: 100px;
}
div.main_block div.block:first-child
{
margin-left: 0;
}
div.main_block div.block:hover
{
border: 1px solid orange;
}
div.main_block div.active
{
border: 1px solid orange;
}
有什么可以自动制作的吗?因此,每次主宽度发生变化时,我都必须更改子边距和宽度,或者如何使其更有效?,如果我在悬停块时将边框添加到块中,如果它在最大边距和宽度上,边框会增加更多宽度,问题就从这里开始