在可点击图像之间添加空格而不会使边距空间可点击

时间:2016-07-16 04:56:00

标签: html css button icons margin

https://jsfiddle.net/ets9rmw9/1/

在参考网站右上角的图标时,我试图在它们之间放置一些空格,但是如果我使用边距将它们分开,边距空间也会变得可点击,这不完全是我想要什么。我似乎无法找到如何在它们之间获得空间而不使其可点击,填充和边距不起作用。

<div class="wrapper">
<img class="logo" src="Logo.png" />
<nav>
<ul class="nav">
  <li class="navlist"><a href="#">Properties</a></li>
  <li class="navlist"><a href="#">The Team</a></li>
  <li class="navlist"><a href="#">Contact Us</a></li>
</ul>
</nav>
<div class="imgs">
<a href="#" title="Twitter" alt=" Icon"><img src="twitter.png" /></a>
<a href="#" title="Facebook" alt=" Icon"><img src="facebook.png" /></a>
<a href="#" title="Instagram" alt=" Icon"><img src="instagram.png" /></a>
</div>
</div>
<footer>
<p class="buttons">Real estate</p>
</footer>


body {
background-color: #ffffff;
margin: 0;
display: table;
height: 100%;
width: 100%;
background-image: url(nice.jpg);
background-size: 100% 100%;
overflow: auto;
}

.wrapper {
display: flex;
flex-direction: row;
justify-content: space-between;
text-align: center;
padding: 0px;
height: auto;
background-color: whitesmoke;
}

footer {
background-color: #cbb492;
display: table-row;
height: 2px;
text-align: center;
}

li a {
text-decoration: none;
font-variant: small-caps;
color: black;
}

li:hover {
background-color: #cbb492;
border-bottom: 0.5px solid gray;
}

nav {
padding-bottom: 2px;
padding-top: 2px;
background-color: whitesmoke;
}

.logo {
height: 28px;
width: 90px;
z-index: -10;
}

p {
color: white;
font-size: 6px;
text-align: left;
padding-left: 20px;
} 

.navlist {
display: inline;
padding-left: 30px;
margin-left: 10px;
margin-right: 10px;
padding-right: 30px;
padding-top: 5.3px;
padding-bottom: 6.2px;
}

.nav {
list-style: none;
padding: 0;
width: 100%;
margin: 1px;
top: 0px;
margin-top: 3px;
}

.imgs {
list-style: none;
margin: 0;
padding: 0px;
float: right;
width: 60px;
height: 100%;
padding-top: 5.5px;
padding-bottom: 5.5px;
}

.imgs img {
width: 20%;
height: 20%;
opacity: 0.7;
margin-right: 5px;
} 

.imgs img:hover {
opacity: 1.0;
} 

2 个答案:

答案 0 :(得分:0)

请添加此css:

.imgs img {
display: inline-block;
}

答案 1 :(得分:0)

display:inline-block代码中使用img并在a代码中添加保证金。像这样:

.imgs img {  
   display:inline-block;
}
.imgs a{
  margin-right:5px;     
}

以下是您的更新小提琴代码:https://jsfiddle.net/ets9rmw9/3/