I have an icon list made of social media but they\'re only clickable on the letter of the icon, I want it to be clickable on any spot but I have to click on the \"F\" of faceboo
A possible workaround will be using css. anchor is inline element and it only wraps the icon. We need anchor to cover whole area in li
using css
ul li a{
display:inline-block;
width:100%;
height:100%;
}
I would use inherit for de with and height of the li
items. I used flexbox
to align everything in the center. When hyperlinks are created for the other icons, you can remove the flexbox settings for li
.
li {
width: 50px;
height: 50px;
background-color: pink;
border: thin solid black;
list-style: none;
display: flex;
justify-content: center;
align-items: center;
}
li>a {
width: inherit;
height: inherit;
display: flex;
justify-content: center;
align-items: center;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
<div class="leftside">
<ul class="socialmediaicons">
<li><a href="https://www.facebook.com/EnUnChasquido/"><i class="fa fa-facebook"></i></a></li>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-youtube"></i></li>
</ul>
</div>
li{
border:1px solid red;
display: inline-block;
}
.fa{
padding:15px;
padding-bottom: 15px;
padding-top:15px;
}
a{
display: block;
}
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="leftside">
<ul class="socialmediaicons">
<li><a href="https://www.facebook.com/EnUnChasquido/"><i class="fa fa-facebook"></i></a></li>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-youtube"></i></li>
</ul>
</div>
</body>
</html>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
li{
border:1px solid red;
display: inline-block;
}
.fa{
padding:15px;
padding-bottom: 15px;
padding-top:15px;
}
a{
display: block;
}
</style>
</head>
<body>
<div class="leftside">
<ul class="socialmediaicons">
<li><a href="https://www.facebook.com/EnUnChasquido/"><i class="fa fa-facebook"></i></li></a>
<li><i class="fa fa-instagram"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-youtube"></i></li>
</ul>
</div>
</body>
</html>