For some reason, I can't change fontawesome icon colors - font-awesome

I have fontawesome called properly in the header:
<link rel="stylesheet" href="css/fontawesome-all.min.css">
and also at the bottom:
<script src="https://use.fontawesome.com/releases/v5.5.0/js/all.js"></script>
This is my HTML:
<div class="socials">
<i class="fas fa-envelope"></i>
<i class="fab fa-facebook"></i>
<i class="fab fa-twitter-square"></i>
<i class="fab fa-github-square"></i>
</div>
And this is my style/sass:
.socials{
a{
margin-left: 1em;
fill: pink;
transition: .3s;
font-size: 4em;
&:hover{
color: red;
background-color: blue;
}
}
}
I can change the font-size and margin. But for some reason, I can't change the color. I saw that there might be an instance that I have used the SVG version instead and that fill property is the one that should be used, but still to no avail.

if that's you want, then the problem is that you used square icons.
<div class="socials">
<i class="fas fa-envelope"></i>
<i class="fab fa-facebook-f"></i>
<i class="fab fa-twitter"></i>
<i class="fab fa-github"></i>
</div>
.socials {
a {
display: inline-block;
width: 6rem;
height: 6rem;
font-size: 4rem;
transition: 0.3s;
background: transparent;
text-align: center;
line-height: 6rem;
&:hover {
color: red;
background: blue;
}
}
}

Related

HTML CSS background cut off at the top

.footer-bar {
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.footer-bar a {
height: 100vh;
text-align: center;
padding: 8px;
transition: all 0.3s ease;
color: var(--smlink);
font-size: 20px;
}
.youtube {
background: #FF0000;
color: var(--smlink);
}
<div class="footer-socialbar">
<div class="footer-bar">
<i class="fa fa-youtube fa-2x"></i>
<i class="fa fa-facebook fa-2x"></i>
<i class="fa fa-twitter fa-2x"></i>
<i class="fa fa-spotify fa-2x"></i>
</div>
</div>
I wonder how I can make these buttons appear right so that the color appears around the whole link.
That's how they appear on the screen.
https://i.stack.imgur.com/2qyeK.png
I want them not to like where cut off at the top, how can I achieve this?
The color of the links in CSS named .youtube
Posted only one color because the rest is exactly the same.
If anybody can help it would be great...
Thx
I'm not sure what you're using the translation for so I took that out from the snippet below to address the issue. The anchor tags aren't displayed as block elements for you. If you put them inside a flexbox and give them an explicit size, they will work. The snippet works, but it doesn't have font-awesome, so you'll have to use your imagination with the result of it.
.footer-bar {
display: flex;
flex-flow: row wrap;
}
.footer-bar a {
text-align: center;
padding: 8px;
transition: all 0.3s ease;
color: var(--smlink);
background: #a33;
width: 40px;
height: 40px;
}
.footer-bar a.youtube {
background: #a33;
}
.footer-bar a.facebook {
background: #00f;
}
.footer-bar a.twitter {
background: #ff0;
}
.footer-bar a.spotify {
background: #00703c;
}
<div class="footer-socialbar">
<div class="footer-bar">
<i class="fa fa-youtube fa-2x"></i>
<i class="fa fa-facebook fa-2x"></i>
<i class="fa fa-twitter fa-2x"></i>
<i class="fa fa-spotify fa-2x"></i>
</div>
</div>

Set different special color for each Font Awesome's icon with hover

i am getting a problem on hover, i want to give effects on hover for a single icon without affecting others
i am using
.follow {
display: flex;
font-family: 'Rubik', serif;
}
.follow1 {
font-size: 20px;
padding-right: 50px;
}
.icon i {
font-size: 2em;
padding-right: 45px;
}
.icon i:hover {
font-size: 2.5em;
transform: rotate(15deg);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"></script>
<div class="follow">
<p class="follow1">Follow Us on:</p>
<div class="icon">
<i class="fab fa-facebook-f" style="color: rgb(11,134,238)"></i>
<i class="fab fa-instagram" style="color:rgb(193,50,158)"></i>
<i class="fab fa-twitter" style="color: rgb(29,161,242)"></i>
<i class="fab fa-google-plus-g" style="color: rgb(221,77,66)"></i>
</div>
</div>
Wrap your icons with a span. And use CSS variables to assign a special color for each.
.follow {
display: flex;
font-family: 'Rubik', serif;
}
.follow1 {
font-size: 20px;
padding-right: 50px;
}
.icon span {
font-size: 2em;
padding-right: 45px;
display: inline-block;
transition: .2s;
}
.icon span:hover {
color: var(--color);
transform: rotate(15deg);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"></script>
<div class="follow">
<p class="follow1">Follow Us on:</p>
<div class="icon">
<span style="--color: rgb(11,134,238)"><i class="fab fa-facebook-f"></i></span>
<span style="--color: rgb(193,50,158)"><i class="fab fa-instagram"></i></span>
<span style="--color: rgb(29,161,242)"><i class="fab fa-twitter"></i></span>
<span style="--color: rgb(221,77,66)"><i class="fab fa-google-plus-g"></i></span>
</div>
</div>
.follow {
display: flex;
font-family: 'Rubik', serif;
}
.follow1 {
font-size: 20px;
padding-right: 50px;
}
.icon i {
font-size: 2em;
padding-right: 45px;
}
.fa-instagram:hover {
font-size: 2.5em;
transform: rotate(15deg);
display:inline-block;
}
.icon{
display:flex;}
<script src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"></script>
<div class="follow">
<p class="follow1">Follow Us on:</p>
<div class="icon">
<i class="fab fa-facebook-f" style="color: rgb(11,134,238)"></i>
<i class="fab fa-instagram" style="color:rgb(193,50,158)"></i>
<i class="fab fa-twitter" style="color: rgb(29,161,242)"></i>
<i class="fab fa-google-plus-g" style="color: rgb(221,77,66)"></i>
</div>
</div>
Icon class put in every (i-tag class) before (fab) class

How to align photos horizontally that was previously aligned vertically?

I'm "converting" a responsive website and need help with aligning 3 images horizontally that was previously aligned vertically on mobile. I have read some StackOverflow posts, but can't find any solution that works for me.
Check out JSFiddle: https://jsfiddle.net/8dkgcyfq/1/
<section class="team">
<div>
<img src="img/lady.jpg">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
<div>
<img src="img/lady.jpg">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
<div>
<img src="img/lady.jpg">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
</section>
#media only screen and (min-width: 1000px) {
.team img {
width: 25%;
height: auto;
display: block;
padding-top: 20px;
}
.team {
text-align: center;
}
.team h2 {
font-family: "Catamaran";
font-size: 20px;
color: white;
font-weight: 300;
text-align: center;
padding-top: 20px;
}
.team h1 {
font-family: "Catamaran";
font-size: 15px;
color: white;
font-weight: 300;
text-align: center;
padding-top: 5px;
}
.team i {
font-size: 25px;
color: white;
padding-top: 10px;
}
}
Need some help aligning these photos horizontally.
Per my comments, I would use flexbox and a mobile first approach meaning you should only need to change the width in your media query:
/* put all default styleing outside media query */
.team {
display:flex;
flex-direction:row;
flex-wrap:wrap;
}
/* I always do mobile first then media query tablet and above */
.team > div {
/* personally, I would give these divs a class instead of having to do a bare selector (the slowest of all element selectors) */
width:100%;
}
#media only screen and (min-width: 1000px) {
.team > div {
width: 25%;
}
}
<section class="team">
<div>
<img src="img/lady.jpg">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
<div>
<img src="img/lady.jpg">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
<div>
<img src="img/lady.jpg">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
</section>
You can use display:flex on .team . On mobile ( so default ) you use flex-direction : column so the images are vertically one under the other.
In media query ( where you want to change them ) use flex-direction: row. This way the images ( divs ) will be on one row And style from there.
Check jsfiddle or snippet below.
.team {
display: flex;
flex-direction: column;
}
#media only screen and (min-width: 1000px) {
.team img {
width: 100%;
height: auto;
display: block;
padding-top: 20px;
}
.team {
text-align: center;
flex-direction: row;
}
.team h2 {
font-family: "Catamaran";
font-size: 20px;
color: white;
font-weight: 300;
text-align: center;
padding-top: 20px;
}
.team h1 {
font-family: "Catamaran";
font-size: 15px;
color: white;
font-weight: 300;
text-align: center;
padding-top: 5px;
}
.team i {
font-size: 25px;
color: white;
padding-top: 10px;
}
}
<section class="team">
<div>
<img src="https://via.placeholder.com/150">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
<div>
<img src="https://via.placeholder.com/150">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
<div>
<img src="https://via.placeholder.com/150">
<h2>Navn Navnesen</h2>
<h1>contact#gmail.com</h1>
<i class="fab fa-facebook"></i>
<i class="fab fa-instagram"></i>
<i class="fab fa-linkedin"></i>
</div>
</section>

Font awesome borders

I'm trying to add a border to my font awesome icons like the picture below:
Yes i managed to do it, but this is not the right way to go I'll explain you why after you see my code:
Html:
<div id= "contact">
<i class="fa fa-envelope-o fa-2x"></i>
<i class="fa fa-phone fa-2x"></i>
</div>
And the CSS:
/*font awesome*/
i.fa-envelope-o {
width:50px;
height:50px;
display: inline-block;
border:2px solid white;
border-radius: 60px;
}
.fa-envelope-o {
padding-top: 5px;
}
i.fa-phone {
width:50px;
height:50px;
display: inline-block;
border:2px solid white;
border-radius: 60px;
}
.fa-phone {
padding-top: 5px;
}
As you can see this is not the right way, what if i have to use the envelope icon once again but without a border? And to center it i had to use padding top. Is there a cleaner way to do this? I don't want to use the i tag alone, since the text above uses it aswel for, for example:
<p><i>hello</i></p>
Thanks in advance,
Kevin
Try this:
div#contact {
background-color: black;
}
#contact i.fa {
border: 2px solid #fff;
border-radius: 60px;
color: #fff;
display: inline-block;
height: 30px;
margin: 5px;
padding: 15px;
width: 30px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<div id= "contact">
<i class="fa fa-envelope-o fa-2x"></i>
<i class="fa fa-phone fa-2x"></i>
</div>
Just create a new css class and use both the font-awesome class and your custom one. For example:
<i class="fa fa-envelope-o custom-envelope fa-2x"></i>
This will apply the custom styles you wanted, such as the border-radius, padding, etc.
If you then want to use the default style for an icon, just omit this extra class and leave the font-awesome class in:
<i class="fa fa-envelope-o fa-2x"></i>
Demo
i.custom-envelope {
width: 50px;
height: 50px;
display: inline-block;
border: 2px solid white;
border-radius: 60px;
}
.custom-envelope {
padding-top: 5px;
}
#contact {
background: black;
color: white;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.2/css/font-awesome.min.css">
<div id="contact">
Custom: <i class="fa fa-envelope-o custom-envelope fa-2x"></i>
<br>
Default: <i class="fa fa-envelope-o fa-2x"></i>
</div>

How to add space in between font-awesome icons in a horizontal row

Been going at this for quite some time now. I think my brain just hurts from coding for too long heres my html:
<div class="icons">
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</div>
and heres my css:
.icons a {
display: inline;
position: fixed;
text-align: center;
top: 363px;
vertical-align: middle;
z-index: 1000;
height: 36px;
width: 36px;
text-decoration: none;
}
.fa, .fa-instagram, .fa-twitter, .fa-facebook {
padding-right: 5px;
}
Your html is not right try this fix:
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
and try this css:
display: block;
margin-right: 15px;
or
display: block;
padding-right: 15px;
If I understand the trouble correctly, it's a combination of the html problem #jack smith caught and then either conflicting styles from somewhere else or the position: fixed - not sure what that's doing there, but in the code you've provided that's going to make them all lump together.
Note also that in your CSS you can just say .fa {...} instead of .fa, .fa-instagram, .fa-twitter, .fa-facebook {...} since those all have the fa class. In this snippet I'm using .icons i but it could just as well be .icons .fa or, if you want this to apply to all font awesome icons, just a bare .fa
.icons a {
margin-right: 10px;/*space to the right of the blue*/ outline
padding-right: 10px;/*between the red and blue outlines*/
outline: 1px solid blue;
/* you can add any of these */
/*
display: inline;
text-align: center;
top: 363px;
vertical-align: middle;
z-index: 1000;
height: 36px;
width: 36px;
text-decoration: none;
*/
}
.icons i {
padding-right: 10px;/*space before the red outline*/
margin-right: 10px;/*also between the red and blue*/
outline: 1px solid red;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="icons">
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</div>