I created both clickable icons and button that will redirect to external links but I've just noticed these 'invisible' buttons exist. I also know that these clickable spaces are the original positions these icons/image are from and I have used "left: xx%" to reposition them but how can I make this 'invisible' buttons disappear or is there any better way to reposition these icons/button?
The icons are not visible as I'm using an external stylesheet and I can't seem to include it but the button is and pressing the tab button on the result screen will show the problem.
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css);
button {
color: #d4af37;
padding: 5px 25px;
border: 2px solid #d4af37;
position: relative;
margin: auto;
z-index: 1;
overflow: hidden;
transition: 0.3s;
}
button:after {
content: '';
background-color: #252526;
position: absolute;
z-index: -2;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
}
button:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0%;
height: 100%;
background-color: #d4af37;
transition: 0.3s;
z-index: -1;
}
button:hover {
cursor: pointer;
color: #252526;
}
button:hover:before {
width: 100%;
}
button:focus {
outline: none;
}
.contact {
font-size: 20px;
top: 0.8em;
left: 41.5%;
transform: translateY(20px);
transition: transform 1s, opacity 1s;
transition-delay: 0.7s;
}
.git {
color: white;
position: relative;
left: 13%;
transform: translateY(0);
transition: transform 0.5s;
padding-bottom: 5%;
}
.git:hover {
cursor: pointer;
transform: translateY(-2.5px);
transition: transform 0.5s;
}
.linked {
color: white;
position: relative;
left: 91.5%;
transform: translateY(0);
transition: transform 0.5s;
padding-bottom: 5%;
}
.linked:hover {
cursor: pointer;
transform: translateY(-2.5px);
transition: transform 0.5s;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<body>
<br><br><br><br><br>
<a href=""><button type="button" id="contactbutton" class="contact animated">Let's Talk</button></a>
<div>
<div class="row" id="link-git">
<div class="col-lg-6 col-md-6 col-sm-6">
<a href="" target="_blank"><i class="fa fa-linkedin linked" style="font-size: 35px;"></i></a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<a href="" target="_blank"><i class="fa fa-github git" style="font-size: 35px;"></i></a>
</div>
</div>
</div>
</body>
First of all It is illegal in HTML5 to nest Button tag inside a tag.
The reason this issue is happening is you are giving left and transform css to button but a tag is still at it's original place.
@import url(https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css);
button, .abutton {
color: #d4af37;
padding: 5px 25px;
border: 2px solid #d4af37;
position: relative;
margin: auto;
z-index: 1;
overflow: hidden;
transition: 0.3s;
text-decoration: none;
}
button:after, .abutton:after {
content: '';
background-color: #252526;
position: absolute;
z-index: -2;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
}
button:before, .abutton:before {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0%;
height: 100%;
background-color: #d4af37;
transition: 0.3s;
z-index: -1;
}
button:hover, .abutton:hover {
cursor: pointer;
color: #252526;
}
button:hover:before, .abutton:hover:before {
width: 100%;
}
button:focus, .abutton:focus {
outline: none;
}
.contact {
font-size: 20px;
top: 0.8em;
left: 41.5%;
transform: translateY(20px);
transition: transform 1s, opacity 1s;
transition-delay: 0.7s;
}
.git {
color: white;
position: relative;
left: 13%;
transform: translateY(0);
transition: transform 0.5s;
padding-bottom: 5%;
}
.git:hover {
cursor: pointer;
transform: translateY(-2.5px);
transition: transform 0.5s;
}
.linked {
color: white;
position: relative;
left: 91.5%;
transform: translateY(0);
transition: transform 0.5s;
padding-bottom: 5%;
}
.linked:hover {
cursor: pointer;
transform: translateY(-2.5px);
transition: transform 0.5s;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<body>
<br><br><br><br><br>
<a href=""><button type="button" id="contactbutton" class="contact animated">Let's Talk</button></a>
<a href="" type="button" id="contactbutton" class="abutton contact animated">Let's Talk</a>
<div>
<div class="row" id="link-git">
<div class="col-lg-6 col-md-6 col-sm-6">
<a href="" target="_blank"><i class="fa fa-linkedin linked" style="font-size: 35px;"></i></a>
</div>
<div class="col-lg-6 col-md-6 col-sm-6">
<a href="" target="_blank"><i class="fa fa-github git" style="font-size: 35px;"></i></a>
</div>
</div>
</div>
</body>