How to change the properties of a fontawesome icon inside a div? - html

I've been trying to change the icon on my website's side navigation bar to beige but I cannot seem to do it...
I am aware that I should override the icon's property in CSS to do so however, I'm not sure which property I should set
I've tried:
setting .fa-twitter class position to relative
setting .fa-twitter class color to beige
creating a div for the icons inside the parent side navigation div
then changing class fa-twitter's color to white
notes: I used a hover animation for my navigation bar so I want that to stay
HTML:
<div class="container">
<div class="sidebar">
<img id="mainicon" src="mainicon.png">
<h2>Nikukurin</h2>
<hr>
<a id="hvr-bounce-to-right" href="#">HOME</a>
<a id="hvr-bounce-to-right" href="#">PORTFOLIO</a>
<a id="hvr-bounce-to-right" href="#">COMMISSIONS</a>
<a id="hvr-bounce-to-right" href="#">PRODUCTS</a>
</div>
</div>
CSS:
.container {
display: flex;
flex-direction: row;
}
.sidebar {
text-align: center;
position: fixed;
width: 20%;
top: 0;
bottom: 0;
left: 0;
min-width: 200px;
background: #ff9999;
padding: 1%;
}
#mainicon {
border-radius: 50%;
width: 40%;
padding: 3%;
}
.sidebar a {
text-align: left;
text-decoration: none;
display: block;
padding: 5%;
color: beige;
font-family: nikuhead;
letter-spacing: 2px;
position: relative;
margin: 5%;
}
#hvr-bounce-to-right:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #ffbc57;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transform-origin: 0 50%;
transform-origin: 0 50%;
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.2s;
transition-duration: 0.5s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
#hvr-bounce-to-right:hover,
#hvr-bounce-to-right:focus,
#hvr-bounce-to-right:active {
color: #ff6666;
text-decoration: none;
}
#hvr-bounce-to-right:hover:before,
#hvr-bounce-to-right:focus:before,
#hvr-bounce-to-right:active:before {
-webkit-transform: scaleX(1);
transform: scaleX(1);
-webkit-transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66);
}
output right now:
output i want: there's supposed to be a twitter icon right under the "nikukurin" and it's supposed to be white but it's the same color as the div background
thank you for taking the time to read this and thank you for anyone answering in advanced!

ok i found the answer!
so what i was doing wrong is particularly this line:
which was supposed to be
<i class="fa fa-twitter"></i>

First thing is u are missing syntax ,
<i class="fa fa-twitter"></i>
And if that doesn't change the color then:
.sidebar a{
color : white;
}

your code should be changed to this:
<i class="fa fa-twitter"></i>

I am unable to understand the question clearly but whatever i have understood you have to first correct html syntax
<i class="fa fa-twitter"></i>
it will show you the icon, then apply the css to change the icon color
.sidebar a{color:#F5F5DC}

Related

My navigation buttons in HTML website renders in Chrome and Firefox but not Safari?

Here I have the issue where my navigation bar for my website renders in Chrome and Firefox, but in Safari, it does not render at all. The clicks still work, but I cannot see the buttons visually.
See this picture:
Firefox is on the left and Safari is on the right.
Here is the HTML code for the navigation bar:
<nav class="topbar">
<div class="nav_graphics">
<a href="https://play.google.com/store/apps/dev?id=4853083882678511028" target="_blank">
<img class="toxic_flame_icon" src="/images/toxicflame427_icon.png" alt="ToxicFlame427 Icon"/>
</a>
<h1 class="title_header">ToxicFlame427</h1>
</div>
<div class="nav_buttons">
<!--Link the different pages to the main site-->
<a href="/index.html">
<button>
<h3>Home</h3>
</button>
</a>
<a href="/pages/my_creations.html">
<button>
<h3>My Creations</h3>
</button>
</a>
<a href="/pages/about.html">
<button>
<h3>About</h3>
</button>
</a>
<a href="/pages/bug_report.html" class="report_bug_button">
<button>
<h3>Report A Bug</h3>
</button>
</a>
</div>
</nav>
And here is the CSS for it too:
#font-face {
font-family: "ArcadeClassic";
src: url("/font/ArcadeClassic.woff");
}
.topbar{
padding: 10px;
align-content: flex-start;
width: 100%;
height: wrap;
background-color: black;
}
.nav_graphics{
display: flex;
}
.nav_buttons{
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.title_header{
font-family: "ArcadeClassic";
font-size: 2.0em;
vertical-align: top;
display: inline-block;
color: teal;
margin-left: 20px;
margin-right: 20px;
}
.toxic_flame_icon{
display: inline-block;
height: 100px;
transition: 1s;
}
.toxic_flame_icon:hover{
transform: rotate(180deg);
}
.topbar button{
font-size: 0.9em;
transition: 0.25s;
-webkit-transition: 0.25s;
-moz-transition: 0.25s;
-o-transition: 0.25s;
position: relative;
bottom: 15px;
border-radius: 5px;
border-color: transparent;
color: red;
height: 15%;
width: 130px;
background-color: transparent;
font-weight: bold;
margin-top: 15px;
}
#media only screen and (max-width:600px){
.topbar button{
font-size: 0.8em;
}
.title_header{
font-size: 1.7em;
}
}
.topbar button:hover{
color: turquoise;
transform: translateY(-5px);
-webkit-transform: translateY(-5px);
-o-transform: translateY(-5px);
-ms-transform: translateY(-5px);
-moz-transform: translateY(-5px);
}
/*Make sure that the little blue lines cant be seen*/
.topbar a{
color: transparent;
}
May it have something to do with font? Or something else i did not catch?
The site is online at https://toxicflame427.xyz if anyone needs to see more code.
It's happening because your button element has 15% height and the way Safari and other browsers handle the overflow inside a button is different.
Simply remove the height restriction (or set it larger) and it will work.
Also, side note: in both browsers, the button is not covering its content and it's not a good practice. Plus, a percentage height inside an a element without a specified height is not good either.

Hover animation bounce

I am trying to make it so that the H2 and the span text has a bit of a bounce effect towards the end of the hover animation I've created. What I am trying to do can be seen in the following example. Just to be clear in that example, SCSS is being used. I am not using SCSS so I am not 100% sure what I am trying to do is possible with just plain CSS but I sure hope it is because that is what I am using for my project. So the code below shows you what I was able to do. The H2 and span text have a basic start point and end point animation on hover. I want it to have a little bounce towards the end(like in the linked example I shared) something I feel I need to add key-frames to in order to achieve. But I don't know if its even possible to add a key-frame animation on hover especially if I want it to animate back to its original position on mouse out. Am I wrong about this? I appreciate any solutions you guys might have. thank you.
body {
background-color: black;
}
.featured-list li {
display: inline-block;
margin-right: .8%;
}
.featured-list a {
display: block;
}
.featured-list {
text-align: center;
padding: 0;
margin: 0 auto;
}
a.feature-img img {
width: 425px;
border-radius: 5px;
transition: .2s linear;
}
a.feature-img {
text-align: center;
}
.f-cta, .f-img-content h2 {
font-family: 'Abel',Helvetica,Arial,Lucida,sans-serif;
font-weight: 100;
position: absolute;
left: 0;
right: 0;
margin: 0 auto;
}
.f-img-content h2 {
color: #fff;
top: -60%;
transition: .2s linear;
}
.f-cta {
background: #fff;
width: 50%;
border-radius: 3px;
padding: 7px;
color: #000;
top: 120%;
font-size: 1.3em;
transition: .2s linear;
}
.f-img-content {
position: relative;
text-align: center;
overflow: hidden;
}
a.feature-img:hover img {
opacity: .6;
}
a.feature-img:hover h2 {
transform: translateY(1065%);
}
a.feature-img:hover span.f-cta {
transform: translateY(-600%);
}
<ul class="featured-list">
<li><a href="#" class="feature-img">
<div class="f-img-content">
<img src="https://i.imgur.com/EENJU66.gif">
<h2>Lorem Ipsum project title</h2>
<span class="f-cta">View Project</span>
</div>
</a></li>
<!--li><a href="#" class="feature-img">
<img src="https://i.imgur.com/EENJU66.gif">
</a></li>
<li><a href="#" class="feature-img">
<img src="https://i.imgur.com/EENJU66.gif">
</a></li>
<li><a href="#" class="feature-img">
<img src="https://i.imgur.com/EENJU66.gif">
</a></li-->
</ul>
You just need cubic-bezier transitions.
Something like this one - https://easings.net/#easeInOutBack
Or the same as this from your example:
transition:all .3s cubic-bezier(.3, 0, 0, 1.3);
Just play around with it :)

Why does a tag with position fixed have a slightly different position on different html pages?

I have a tag (div.natalie p) that kind of jumps on different html pages (index.html, about.html, shop.html, work.html etc.) It has a position fixed and all the css is the same, so technically it should be in the exact same position on each page, but it's not. It's odd because I have a nav tag on the other side that works and has the exact same position on each of the html pages. I hope the attached images make my problem a little clearer.
div.natalie p {
position: fixed;
font-family: "MenaGrotesk-Light";
font-size: 16px;
top: 50%;
left: 40px;
transform-origin: 0 0;
transform: rotate(-90deg) translate(-50%, 0);
z-index: 5;
}
nav {
position: fixed;
top: 50%;
right: 40px;
transform-origin: 100% 0;
transform: rotate(90deg) translate(50%, 0);
}
nav a {
margin: 5px;
font-family: "MenaGrotesk-Light";
font-size: 16px;
transform: rotate(90deg);
text-decoration: none;
color: black;
transition: 0.1s ease-out;
}
nav a:hover {
border-bottom: solid 3px black;
}
<div class="natalie">
<p>Natalie Taylor</p>
</div>
<nav>
<a class="hover" href="index.html">work</a>
<a class="hover" href="shop.html">shop</a>
<a class="hover" href="about.html">about</a>
<a class="hover" href="impressum.html">imprint</a>
</nav>

Hover effecting other elements other than the item being hovered

I am having a hover issue. Whenever I hover over a specific .servNavItemTitle the font weight for the other .servNavItemTitle decreases for a moment and then goes back to normal quickly.
To see it in the demo, just hover over one of the titles and watch the other titles as the font-weight reduces.
Does anyone see what the issue is?
Here is a jsfiddle demo
Here is a narrowed down version of the code:
.servNavItemWrap {
display: inline-block;
vertical-align: top;
width: 25%;
margin-bottom: 50px;
text-align: center;
cursor: pointer;
}
.servNavItemWrap img {
width: 75px;
height: 75px;
-webkit-transition: all 0.25s;
transition: all 0.25s;
}
.servNavItemWrap:hover img {
-webkit-transition: all 0.25s;
transition: all 0.25s;
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
.servNavItemWrap a {
text-decoration: none;
outline: none;
}
.servNavItemTitle {
margin-top: 5px;
-webkit-transition: all 0.25s;
transition: all 0.25s;
}
.servNavItemWrap:hover .servNavItemTitle {
color: #FFF;
-webkit-transition: all 0.25s;
transition: all 0.25s;
}
<div id="serviceNavBlock2" class="iblock">
<div class="servNavItemWrap">
<a href="http://localhost:8080/profile.php">
<img src="" alt="Aluminum Profile">
<span class="servNavItemTitle hGc block">Aluminum</span>
</a>
</div>
<div class="servNavItemWrap">
<a href="#">
<img src="" alt="Aluminum Components">
<span class="servNavItemTitle hGc block">Components</span>
</a>
</div>
After Temani narrowed down the issue, I searched and found the answer here: css transform element affects other element which use transform:scale(0.5) in android webview . Basically, I added -webkit-backface-visibility: hidden; to the scaled image and it works perfectly now.

Why don't my :active' or :checked selectors work?

I have a hidden sidebar menu on my website, if I open my website on my desktop, my hidden sidebar has 100px width (not full), so to reveal it all you must do is hover over it. If I open my website on a mobile device, my hidden sidebar has no width, and I must click the button to reveal the sidebar.
HTML:
<div id="mySidenav" class="sidenav sidenav-wrapper">
<img class="logo1" src="../img/logo1.png"><br><br>
Home
About
Contact
</div>
<div id="contoh" class="content-section-b">
<div class="mobiletoggle">
<label class="fa fa-bars" for="showblock"></label>
<input type="checkbox" id="showblock" />
</div>
</div>
In the code above I use checkbox to change 'click', because I just want to use CSS.
CSS:
.sidenav {
height: 100%;
width: 100px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: #111;
overflow-x: hidden;
padding-top: 60px;
transition: 0.8s;
}
.logo1 {
height: 10%;
width: auto;
padding-left: 20px;
transition: 0.8s;
}
.sidenav:hover {
width: 250px;
transition: 0.8s;
}
.sidenav:hover ~ #contoh {
background-color: rgba(0,0,0,0.4);
filter: grayscale(100%);
}
.sidenav:hover .logo1 {
height: auto;
width: 95%;
padding-left: 10px;
transition: 0.8s;
}
.sidenav a {
float:left;
width:100%;
padding: 8px 8px 8px 32px;
text-decoration: none;
font-size: 20px;
color: #818181;
display: block;
opacity: 0;
transition: opacity 1300ms
}
.sidenav a:hover, .offcanvas a:focus {
color: #f1f1f1;
background-color:#5fa2db;
font-size: 30px;
}
#showblock {
display: none;
}
#media screen and (min-width:768px) {
.mobiletoggle {
display:none;
}
}
#media screen and (max-width:767px) {
.sidenav {
width:0px;
}
#showblock:checked + .sidenav {
width: 250px;
transition: 0.8s;
}
}
In the code above I used :checked, it's just a little bit different if I use :active. The problem is why my :checked/:active did not work? I looked into this jsFiddle, and it works fine, so why can't I use it? Any suggestions?
As per your CSS, modify your HTML to:
<input type="checkbox" id="showblock">
<div id="mySidenav" class="sidenav sidenav-wrapper">
<img class="logo1" src="../img/logo1.png"><br><br>
Home
About
Contact
</div>
<div id ="contoh" class="content-section-b">
<div class="mobiletoggle">
<label class="fa fa-bars" for="showblock"></label>
</div>
</div>
The input #showblock should be above the div #mySidenav in order for your CSS to work.
#showblock:checked + .sidenav {
width: 250px;
transition: 0.8s;
}