如何在小设备中div间添加边框而不影响大设备

问题描述:

在大设备边框右边应该显示并且在小设备边框底部应该显示而不会影响大设备和div之间的一些间距小设备 如何在小设备中div间添加边框而不影响大设备

+0

欢迎使用*。请编辑你的问题,下面:https://*.com/help/how-to-ask。它没有意义。 –

<div class="col-sm-6"> 
    <div class="box"> 
    ... 
    </div> 
</div> 

<div class="col-sm-6"> 
    <div class="box"> 
    ... 
    </div> 
</div> 

<style> 
/*Desktop*/ 
.box{ border-right:#000 solid 1px;} 

/*Small Screen - below 768 resolution device*/ 
@media only screen and (max-width: 768px){ 
    .box{border-right:none; border-bottom:#000 solid 1px; margin-bottom:20px;} 
} 
</style> 

你应该添加媒体查询到小型设备

@media only screen and (max-width: 300px) 
 
{ 
 
your div name 
 
{ 
 
    border-style: solid; 
 
    border-bottom: thick dotted #ff0000; 
 
} 
 
}

<div class="col-sm-6"> 
    <div class="box"> 
    ... 
    </div> 
</div> 

<div class="col-sm-6"> 
    <div class="box"> 
    ... 
    </div> 
</div> 

<style> 
.box{ border-right:#000 solid 1px;} 

/*Small Screen - below 768 resolution device*/ 
@media only screen and (max-width: 768px){.box{border-right:none; border-bottom:#000 solid 1px; margin-bottom:20px;}} 
</style>