繁体   English   中英

我如何删除col-md-6段中剩余的边距

[英]How i can remove margin left from col-md-6 paragraph

我一直在尝试从p标签的col-md-6中删除col-md-6的margin-left,但无法正常工作

我已经试过了

 @media (min-width:320px) and (max-width:425px) { .col-md-6 { /* No Space */ margin-left: 0; } } 

它没有保证金。 Col-md-6的左填充和右填充始终为15px。

尝试这个:

@media (max-width: 425px){
.col-md-6{ padding-left: 0; }
}

如果您正在使用bootstrap col,请使用padding来为col-md-6添加类pl-0 ,如果要在特定屏幕宽度上使用它,则可以使用bootstrap断点,如: pl-md-0

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>JS Bin</title> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> </head> <body> <section> <div class="container"> <div class="row no-gutters"> <div class="col-6 bg-danger"> <p>Lorem Ipsum</p> </div> <div class="col-6 bg-primary"> <p>Lorem Ipsum</p> </div> </div> </div> </section> </body> </html> 

可以使用.no-gutters删除预定义网格类别中列之间的.no-gutters 这将删除.row的负边距和所有直接子列的水平边距。

然后,您可以为div分配所需的边距或边距。 希望它能解决您的问题

您需要切换值:

 @media (max-width:425px ) and (min-width:320px) { .col-md-6{ margin-left:0;} } 

就这样...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM