I was try to set icons and text on images but it put extra space beside image, so how can i remove extra space from image?
.fb {
position: absolute;
top: 0px;
right: 5px;
z-index: 100;
}
.tweeter {
position: absolute;
top: 20px;
right: 5px;
z-index: 100;
}
img {
overflow: hidden;
}
div {
height: 250px;
width: 250px;
display: inline;
}
<div>
<img https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
<div>
<img https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
<div>
<img https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
<div>
<img https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
first : your img tags are not correct. should be <img src="url">
second : display:inline generates white spaces between elements. so i suggest you use float:left instead
for example if you want 4 divs on one row, use float:left;width:25%; that way you are sure there are no white spaces between the divs
also to be sure the img covers all the width of the div, use width:100%;height:auto on the img. plus overflow:hidden on the img has no effect . you can use it on the div instead
see snippet below :
.fb {
position: absolute;
top: 0px;
right: 5px;
z-index: 100;
}
.tweeter {
position: absolute;
top: 20px;
right: 5px;
z-index: 100;
}
img {
width:100%;
height:auto;
}
div {
height: 250px;
width: 250px;
float:left;
width:25%;
position:relative;
}
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"/>
<div>
<img src="https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
<div>
<img src ="https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
<div>
<img src ="https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
<div>
<img src ="https://pbs.twimg.com/profile_images/604644048/sign051.gif">
<a class="fb" href=""><i class="fa fa-facebook-official" aria-hidden="true"></i></a>
<a class="tweeter" href=""><i class="fa fa-twitter-square" aria-hidden="true"></i></a>
</div>
Related
I am trying to make a social media menu, the Font Awesome Icons are all visible and the way I want but the hyperlink is not working on it.....
Here is my code:
.sm-list {
display: flex;
}
.sm-link {
color: #929FC5;
width: 3rem;
height: 3rem;
border: 1px solid #929FC5;
border-radius: 90%;
display: flex;
align-items: center;
justify-content: center;
margin-right: 0.5rem;
}
.sm-link:last-child {
margin-right: 0;
}
.sm-link:hover {
background-image: linear-gradient(to right, #A971FF, #00F0FF);
color: #FFF;
}
<div class="sm-list">
<a href="https://www.facebook.com/" class="sm-link">
<i class="fab fa-facebook"></i>
</a>
<a href="https://www.instagram.com/" class="sm-link">
<i class="fab fa-instagram"></i>
</a>
<a href="https://www.twitter.com/" class="sm-link">
<i class="fab fa-twitter"></i>
</a>
<a href="https://www.youtube.com/" class="sm-link">
<i class="fab fa-youtube"></i>
</a>
</div>
I was able to load the icons with the following code. You must first load the Font Awesome in the head tag
<head>
<link rel="stylesheet" href="mystyle.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet">
</head>
<body>
<div class="sm-list">
<a href="https://www.facebook.com/" class="sm-link">
<i class="fab fa-facebook"></i>
</a>
<a href="https://www.instagram.com/" class="sm-link">
<i class="fab fa-instagram"></i>
</a>
<a href="https://www.twitter.com/" class="sm-link">
<i class="fab fa-twitter"></i>
</a>
<a href="https://www.youtube.com/" class="sm-link">
<i class="fab fa-youtube"></i>
</a>
</div>
</body>
The background color is not appearing, I want to set the social media icons with some background color which covers the whole webpage width and a specific height.
<div class = "social-media">
<div class="middle">
<a class="btn" href="#">
<i class="fab fa-facebook-f"></i>
</a>
<a class="btn" href="#">
<i class="fab fa-instagram"></i>
</a>
<a class="btn" href="#">
<i class="fab fa-linkedin-in"></i>
</a>
<a class="btn" href="#">
<i class="fab fa-twitter"></i>
</a>
</div>
</>
CSS:
.social-media{
background-color: black;
position: absolute;
height: 10%;
}
Set the left:0 and right:0 position.
.social-media{
background-color: black;
position: absolute;
height: 10%;
left: 0;
right: 0;
}
You should specify width and height too.
Set width to CSS Class
.social-media{
background-color: black;
position: absolute;
height: 10%;
width:10%;
}
I have this unordered list and on phones with small screen width I want to place each 2 items on a single line, how can I implement that? thanks in advance.
<a href="mailto:shouman882#gmail.com" class="footer_link">
shouman882#gmail.com
</a>
<ul class="social_list">
<li class="social_list_item"> <a class="social_list_item_link" href="https://www.facebook.com/samtshouman">
<i class="fab fa-facebook"></i>
</a>
</li>
<li class="social_list_item"> <a class="social_list_item_link" href="https://github.com/SamShouman">
<i class="fab fa-github">
</i>
</a> </li>
<li class="social_list_item"> <a class="social_list_item_link" href="https://instagram.com/sam_shmn98?igshid=1k437cycqmauk">
<i class="fab fa-instagram"></i>
</a>
</li>
<li class="social_list_item"> <a class="social_list_item_link" href="https://api.whatsapp.com/send?phone=96103943517&source=&data=&app_absent=">
<i class="fab fa-whatsapp"></i>
</a>
</li>
</ul>
You can do something like this, it will wrap last 2 items when screen size decreases.
.social_list {
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
.first,
.second {
display: flex;
padding: 10px;
}
.first li,
.second li {
margin: 15px;
}
<a href="mailto:shouman882#gmail.com" class="footer_link">
shouman882#gmail.com
</a>
<ul class="social_list">
<div class="first">
<li class="social_list_item">
<a class="social_list_item_link" href="https://www.facebook.com/samtshouman">
<i class="fab fa-facebook"></i>Facebook
</a>
</li>
<li class="social_list_item">
<a class="social_list_item_link" href="https://github.com/SamShouman">
<i class="fab fa-github">GitHub
</i>
</a>
</li>
</div>
<div class="second">
<li class="social_list_item">
<a class="social_list_item_link" href="https://instagram.com/sam_shmn98?igshid=1k437cycqmauk">
<i class="fab fa-instagram"></i> Instagram
</a>
</li>
<li class="social_list_item">
<a class="social_list_item_link" href="https://api.whatsapp.com/send?phone=96103943517&source=&data=&app_absent=">
<i class="fab fa-whatsapp"></i>Whatsapp
</a>
</li>
</div>
</ul>
Just need to add width: 50%; float: left; to the .social_list_item class with suitable media queries. The sample for a small width screen.
Refer this : https://www.w3schools.com/css/css_rwd_mediaqueries.asp
/* You need to add suitable media queries for mobile devices. */
#media screen and (max-width: 480px) {
li.social_list_item {
width: 50%;
float: left;
}
}
<a href="mailto:shouman882#gmail.com" class="footer_link">
shouman882#gmail.com
</a>
<ul class="social_list">
<li class="social_list_item"><a class="social_list_item_link" href="https://www.facebook.com/samtshouman">
<i class="fab fa-facebook"></i>
</a>
</li>
<li class="social_list_item"><a class="social_list_item_link" href="https://github.com/SamShouman">
<i class="fab fa-github">
</i>
</a></li>
<li class="social_list_item"><a class="social_list_item_link"
href="https://instagram.com/sam_shmn98?igshid=1k437cycqmauk">
<i class="fab fa-instagram"></i>
</a>
</li>
<li class="social_list_item"><a class="social_list_item_link"
href="https://api.whatsapp.com/send?phone=96103943517&source=&data=&app_absent=">
<i class="fab fa-whatsapp"></i>
</a>
</li>
</ul>
I want to put a background to my FA icons, but something like a low opacity circle around them.
Code:
.social {display:block; float:left; margin:auto; height: 50px; font-size: 12px; padding-top:7px; width: 200px; text-align: center; text-decoration: none; border-bottom: 5px solid black;}
.social i {cursor: pointer; display: inline-block; position: relative; transition: 0.5s;}
.social i:after {content: '\00bb'; position: absolute; opacity: 0; top: -1px; right: -50px; transition: 0.2s;}
.social:hover i {padding-right: 20px; color: white;}
.social:hover i:after {opacity: 1; right: 0;}
.my-facebook {background: transparent; color: #3b5998;}
.my-instagram {background: transparent; color: white;}
.my-codepen{background: transparent; color: black;}
.my-github{background: transparent; color: #f5f5f5;}
.my-linkedin{background: transparent; color: #00a0dc;}
.my-fcc{background: transparent; color: #006400;}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div id="buttons">
<a class="social my-codepen" target='_blank' href="#"><i class="fa fa-codepen fa-3x"></i></a>
<a class="social my-github" target='_blank' href="#"><i class="fa fa-github fa-3x"></i></a>
<a class="social my-facebook" target='_blank' href="#"><i class="fa fa-facebook fa-3x"></i></a>
<a class="social my-fcc" target='_blank' href="#"><i class="fa fa-free-code-camp fa-3x"></i></a>
<a class="social my-linkedin" target='_blank' href="#"><i class="fa fa-linkedin fa-3x"></i></a>
<a class="social my-instagram" target='_blank' href="#"><i class="fa fa-instagram fa-3x"></i></a>
</div>
I've tried to change the "background" but it changes the whole square. I want only to give a circular background or a circular border around the icon itself.
Thanks to all!
You need to use stacked icons. I have modified your example for you below.
Code
.social {display:block; float:left; margin:auto; height: 50px; font-size: 12px; padding-top:7px; width: 200px; text-align: center; text-decoration: none; border-bottom: 5px solid black;}
.social i {cursor: pointer; display: inline-block; transition: 0.5s;}
.social i:after {content: '\00bb'; position: absolute; opacity: 0; top: -1px; right: -50px; transition: 0.2s;}
.social:hover i {padding-right: 20px; color: white;}
.social:hover i:after {opacity: 1; right: 0;}
.my-facebook {background: transparent; color: #3b5998;}
.my-instagram {background: transparent; color: black;}
.my-codepen{background: transparent; color: black;}
.my-github{background: transparent; color: black;}
.my-linkedin{background: transparent; color: #00a0dc;}
.my-fcc{background: transparent; color: #006400;}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div id="buttons">
<a class="social my-codepen" target='_blank' href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-codepen fa-stack-1x fa-inverse"></i>
</span>
</a>
<a class="social my-github" target='_blank' href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
</span>
</a>
<a class="social my-facebook" target='_blank' href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
</span>
</a>
<a class="social my-fcc" target='_blank' href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-free-code-camp fa-stack-1x fa-inverse"></i>
</span>
</a>
<a class="social my-linkedin" target='_blank' href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-linkedin fa-stack-1x fa-inverse"></i>
</span>
</a>
<a class="social my-instagram" target='_blank' href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-instagram fa-stack-1x fa-inverse"></i>
</span>
</a>
</div>
Jsfiddle Here
I'm having trouble getting the correct styling for my footer. I've managed to get the correct styling for mobile but for tablet and desktop I'm having a few issues. I'm trying to get the social icons to be centred horizontally off to the right-hand side of the footer. I'm not sure why the have the current set location. Any help in figuring this out would be helpful.
This image shows what I'm trying to achieve for the desktop version. I'm not sure how to do it with out using a fixed margin position which isn't what I want to do as it only then works in chrome and then looks bad in other browsers?
enter link description here
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6">
<p class="copyright text-muted">Copyright © Eat Sleep Kayak 2015</p>
</div>
<div class="footersocialicons col-xs-12 col-sm-6">
<ul class="list-inline">
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-google fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-youtube fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</footer>
/* Footer */
#media (max-width:768px){
footer {text-align: center; padding: 5px;}
}
#media (min-width: 769px) {
footer .list-inline {
float: right;
position:relative;top:50% ;
transform:translateY(-50%);
}
footer .copyright {
float: left;
}
}
footer {
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
/*background-color: #eee;*/
background-color: #6B6A67;
padding-top: 5px;
}
footer .copyright {
font-size: 14px;
}
footer .list-inline {
height: 100%;
}
Add the class .text-center to this line - <div class="footersocialicons col-xs-12 col-sm-6"> to center everything inside.
Try adding a fixed height and line-height to your footer. You also said you wanted the icons to the right, so you add the .text-right class to do that.
The following centers the footer text and icons horizontally and aligns the icons to the right.
<style>
footer {
height: 60px;
line-height: 60px;
}
</style>
<footer>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6">
<p class="copyright text-muted">Copyright © Eat Sleep Kayak 2015</p>
</div>
<div class="footersocialicons col-xs-12 col-sm-6 text-right">
<ul class="list-inline">
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-facebook fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-google fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
<li>
<a href="#">
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-youtube fa-stack-1x fa-inverse"></i>
</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</footer>
Fiddle: http://jsfiddle.net/timgavin/mas4dg0y/