如果子元素中包含css类,如何定位父元素

时间:2019-08-13 21:59:20

标签: html css sass

如何以SASS样式方式定位父类。在下面的样式中,当父div具有带有“ childclass ”类的子元素时,我想在父div上应用 padding 样式。

parentwrapperclass
{
	position: relative;
    bottom: 0px;
    width: 100%;
	

	& > .childclass{		
		    	   padding: 0 15px;		
	}
}
<div class="parentwrapperclass"> 
	<div class="childclass">
	</div>
</div>

0 个答案:

没有答案