简体   繁体   English

如何删除最后一个的右边距

[英]How can I remove the right margin of the last <i>?

I tried :last-child {margin-right: 0;} but it didn't work. 我尝试了:last-child {margin-right: 0;}但是没有用。

 .navigation-menu .social-icons i { margin-top: 15px; margin-right: 10px; color: #FFFFFF; } 
 <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.css" rel="stylesheet" > <div class="social-icons"> <a href=""><i class="fab fa-facebook-f"></i></a> <a href=""><i class="fab fa-twitter"></i></a> <a href=""><i class="fab fa-instagram"></i></a> <a href=""><i class="fab fa-dribbble"></i></a> <a href=""><i class="fab fa-behance"></i></a> </div> 

The selector for that should be 选择器应该是

.navigation-menu .social-icons a:last-child i { ... }

You are adressing the i inside the last a element inside the .social-icons div, so the :last-child has to be appended to the a . 您正在在.social-icons div中的最后 a元素中.social-icons i ,因此:last-child必须附加到a后面。

please add following style 请添加以下样式

.social-icons i:last-child{
  margin-right: 0px;
}

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

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