Icons not centered within div? Align-item: center issue? - html

I have the following code for putting my signature in the footer of a website: https://codepen.io/BarrieO/pen/ayQxoZ
However, when implemting the code on my Wordpress website (http://bartoml215.215.axc.nl/), the icons within the divs are not centered as in the Codepen. I think this has to do with the css property align-items: center for my .icon-footer class, but not sure?
To be clear: I want to allign the icons perfectly in the middle of the rounded squares, not in the bottom-middle as currenctly on the website. I want the same result as in the Codpen.
How come my icons are not alligned in the .icon-footers divs?

You need to do 3 modifications for it to work for your website:
1- Change the main wingedHelmet element class to main-icon-footer
<div id="starter" class="main-icon-footer ">
<img src="https://www.petasos.be/wp-content/uploads/2017/05/wingedHelmetSmall.png" class="petasos">
</div>
2- Add the class main-icon-footer to your CSS file
.main-icon-footer {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border-radius: 25%;
background: white;
border: 1px #818181 solid;
}
3- Remove align-items: center; from .icon-footer in your CSS file
.icon-footer {
position: absolute;
display: flex;
justify-content: center;
width: 50px;
height: 50px;
border-radius: 25%;
background: white;
border: 1px #818181 solid;
}

This is a fix. I tested it on your site.
I really prefer if you do this. but if you don't want this... go below..
note that for this to work you have to replace this code below with the "bottom-bar" div that you already have...
<div id="bottom-bar" class="solid-bg" role="contentinfo">
<div class="wf-wrap">
<div class="wf-container-bottom">
<div class="wf-table wf-mobile-collapsed" style="
text-align: center;
padding-top: 15px;
">
<div id="starter" class="icon-footer" style="
transform: none;
position: static;
margin: auto;
">
<img src="https://www.petasos.be/wp-content/uploads/2017/05/wingedHelmetSmall.png" class="petasos">
</div>
</div>
</div><!-- .wf-container-bottom -->
</div><!-- .wf-wrap -->
</div>
ok the second solution:
just change this css selectors to what i have provided below:
#starter {
cursor: pointer;
width: 70px;
height: 50px;
z-index: 5;
/* left: 215px; */
/* transform: translate(-100%, -100%); */
transition: all 0.6s linear;
filter: invert(100%);
}
.iconHolder {
position: absolute;
/* top: 57px; */
width: 215px;
/* right: 20px; */
}

Related

How to create facebook like loading skeleton using css?

i am new to creating animations...and i would like to create facebook like animation for loading the screen.
What i am trying to do?
i have a card and i want to represent the loading state by using the facebook like loading (skeleton screen with animation) for the div with class "image".
The code is added here
https://codepen.io/harika123/pen/vYEdoOY
Below is the code,
.container {
display: flex;
flex-direction: row;
}
.card {
box-shadow: 3px 3px 5px 0 rgba(0, 0,0, 0.15);
width: 309px;
position: relative;
top: 200px;
left: 250px;
}
.image {
display:flex;
width: 309px;
height: 176px;
background-color: #cccccc;
}
.loading {
position: relative;
top: 80px;
left: 125px;
width: 82px;
height: 20px;
background-color: white;
border-radius: 10px;
}
h4 {
height: 30px;
}
.text {
padding-left: 16px;
}
.footer {
display: flex;
width: 309px;
height: 72px;
background-color: white;
}
<div class="container">
<div class="card">
<div class="image">
<div class="loading">
<div class="text">loading</div>
<div class="button"></div>
</div>
</div>
<div class="footer">
<div class="info">
<h4>Card Name</h4>
</div>
</div>
</div>
</div>
I have tried to add the animations but is not working (look into code from codepen). how can i add the animations like the facebook loading skeleton screen. for facebook we see left to right shimmering effect. i want it to use 90 deg linear gradient. could someone help me with this. thanks.

Is this the most efficient/responsive method of using CSS Grids?

Page Example: https://codepen.io/anthonyhvelazquez/pen/qBBVjBX
The example I posted is a working example of the template I want to have. I have 2 fixed height headers and the rest of the content-container will fill the height of the parent. Anything within the content-container will auto scroll if the child's content is larger than the the content-container. I know there are other functions like minmax, and fit-content and wanted to make sure there isnt a better/more responsive way of setting up the page.
Some other questions I had regarding grids:
If I wanted to have a hidden header that appears and disappears on the click of a button, would it be better using a grid system and trying to animate the grid rows to a height of 0 or would it be better setting up the container as a vertical flex container and modifying the height of the navbars themselves
If I tried to implement this in Angular, would I have to wrap my components in div containers with the grid location style to place them in a grid template properly or can I add the styling to the component itself like so:
<div style="grid-row: 1/2">
<app-component></app-component>
</div>
// or
<app-component style="grid-row: 1/2"></app-component>
The codepen demo is not responsive and to your question. Is it the most responsive method? No, it is not.
With grid system you can make any layout you can think of, but not everywhere you need it.
You can simply use Flex and it will be responsive as well.
I am adding code for a normal web layout. having Header, hero section
content and para and all be responsive. Feel free to go through them and understand them. Feel free to ask anything regarding it. I will help as much I can.
In Angular, you can make components like header, footer and add the respective HTML tags and CSS for the components and imports it in your home page component. Hope this helps.
For two fixed header you can just increse the height of the header in its class. But you have to use js for adding click function and doing the changes in height of that header class.
For the particular example, I had just used flex here.
body, html{
padding: 0px;
margin: 0px ;
box-sizing: border-box;
}
.header{
z-index: 10;
height: 80px;
width: 100%;
position: fixed;
background: linear-gradient( 160deg, #00689b 0%, #00adef 100%);
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.06);
}
.header .logo{
width: 190px;
height: auto;
position: absolute;
top: 54%;
left: 135px;
transform: translate(-50%, -50%);
cursor: pointer;
color: white;
}
.header-links{
display: flex;
flex-direction: row;
float: right;
padding: 9px 20px;
color: white;
font-size: 18px;
}
.header-links span{
padding: 20px;
}
.hero-section{
width: 100%;
height: 80vh;
position: relative;
background-color: turquoise;
top: 80px;
}
.hero-section img{
width: 100%;
height: 80vh;
object-fit: cover;
position: absolute;
}
.hero-section h1{
position: absolute;
text-align: center;
color: white;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.contents-container{
padding: 5% 5%;
position: relative;
width: 100%;
min-height: 100vh;
}
.h-features-container{
padding-top: 20px;
height: auto;
width: 100%;
position: relative;
background-color: white;
z-index: 1;
}
.h-features-container >h3{
justify-content: center;
text-align: center;
font-size: 28px;
color: #111;
}
.features-card-container{
display: flex;
flex-direction: row;
justify-content: center;
flex-wrap: wrap;
margin-top: 10px;
padding: 50px 9%;
box-sizing: border-box;
}
.features-card{
width: 300px;
height: 412px;
background-color: red;
padding: 20px;
margin: 19px;
border-radius: 2px;
background: #fff;
box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.16);
}
.features-card h3{
text-align: center;
}
.features-card p{
font-size: 16px;
}
/* footer */
.h-footer{
min-height: 50vh;
width: 100%;
position: relative;
bottom: 0px;
padding: 0%;
background: linear-gradient( 90deg, #00689b 0%, #00adef 100%);
}
.h-footer-flex{
display: flex;
flex-direction: row;
flex-wrap: wrap;
color: white;
white-space: nowrap;
padding: 20px 20px;
}
.h-copywrite{
text-align: center;
color: white;
position: relative;
}
.f-box{
height: 60%;
width: 25%;
padding: 20px;
margin: 20px;
}
.f-box p{
position: relative;
}
.f-box>p>a{
cursor: pointer;
}
.f-box-links:before {
content: '';
position: absolute;
background: white;
width: 0px;
height: 1px;
top: 20px;
opacity: .8;
transform: translate(0%, 0%);
transition: all 0.3s ease;
}
.f-box-links:hover:before {
width: 25px;
}
.social-icon-1{
margin-left: -8px;
}
#media screen and (max-width:1200px){
.f-box{
height: 60%;
width: 28%;
padding: 20px;
margin: 20px;
}
}
#media screen and (max-width:999px){
.f-box{
height: 60%;
width: 26%;
padding: 20px;
margin: 20px;
}
}
<header class="header">
<div class="logo">
<h2>Main Logo</h2>
</div>
<div class="header-links">
<span>Products</span>
<span>Features</span>
<span>Contact</span>
</div>
</header>
<div class="hero-section">
<img src="https://source.unsplash.com/random">
<h1>This is a simple heading</h1>
</div>
<div id="features-container" class="h-features-container">
<h3>Our Products</h3>
<div class="features-card-container">
<div class="features-card">
<h3>Inventory Management</h3>
<p>Inventory Management Software enables you to Manage Your assets The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Order Management</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Employee Management</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Payroll Management</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
<div class="features-card">
<h3>Attendence System</h3>
<p>Stock Management Software enables you to Manage Your asstes The way you want you can
arrange your assets in a way that helps you to keep easy track.
</p>
</div>
</div>
</div>
<!-- footer -->
<footer class="footer">
<div class="h-footer">
<div class="h-footer-flex">
<div class=" f-box">
<p> <a class="f-box-links">Home</a></p>
<p> <a class="f-box-links">Features</a></p>
<p><a class="f-box-links">Clients</a></p>
<p><a class="f-box-links">Why Us</a></p>
<p><a class="f-box-links">Contact Us</a></p>
</div>
<div class=" f-box">
<p> <a class="f-box-links">Terms and Condition</a></p>
<p> <a class="f-box-links">Privacy Policy</a></p>
</div>
<div class=" f-box">
<p>Follow us</p>
<p>Facebook</p>
<p>Instagram</p>
</div>
</div>
<p class="h-copywrite">© 2019 website.in All Rights Reserved</p>
</div>
</footer>

Why bottom and right does not work accordingly?

I have a layout, that looks as following:
I am trying to place the div circle on buttom and right as following:
$menu-btn: 65px;
.portfolio-container {
width: 100%;
height: 100%;
.show-menu-btn {
display: flex;
justify-content: center;
align-items: center;
height: $menu-btn;
width: $menu-btn;
border-radius: 50%;
background-color: #24344b;
position: sticky;
bottom: 10;
right: 10;
.fa-align-justify {
color: white;
}
}
}
But as you can see, it does not work. What am I doing wrong?
The html code is:
<div class="portfolio-container">
<div class="show-menu-btn">
<i class="fas fa-align-justify fa-2x" />
</div>
</div>
I see two issues with this, firstly, you need to be stating whether the bottom and right are using px, em, rem etc:
bottom: 10px;
right: 10px;
Secondly, you should change your position to absolute rather than sticky

How to center an animated image and unanimated text on a webpage, regardless of the device type, in HTML and CSS?

I tried putting the animated image into a table, but the animation doesn't work in that case.
I can only use HTML and CSS to make this work.
I'm wanting to center the green, spinning circle on the page both vertically and horizontally, have the logo sit without spinning inside of the circle, and have text that changes every 5 seconds right beneath it, centered horizontally and not too far vertically from the edge of the circle.
Right now, with the following code, the mobile version looks like:
(The red circle circles the logo, which is also appearing smaller than I want it to be)
The desktop view currently looks like:
As you can see here, the logo is still slightly off center vertically and the circle is really close to the top of the screen, rather than center.
So far I have in HTML:
<div id="animatedLogo">
<div id="loadingCircle">
<img id="loadingLogo" src="../Content/images/HCSS_GooglePresentation_Spinner_Green.PNG" class="circle" />
</div>
<div id="wordLogo">
<img id="HCSSLogo" src="../Content/images/hcss logo2.jpg" class="logo" />
</div>
<div id="myPhrase" class="phrase"></div>
</div>
<div class="main-container container-fluid">
<div class="row">
<div class="span6">
<form method="post" action="{responseUri}">
{responseFields}
</form>
</div>
</div>
</div>
<link href="../Content/please-wait.css" rel="stylesheet" />
<script src="/Scripts/logoAnimation.js"></script>
<script src="/Scripts/formPostResponse.js"></script>
And in CSS I have:
#animatedLogo {
text-align: center;
}
#loadingLogo {
animation: rotation 2.5s infinite linear;
min-height: 100%;
min-width: 35%;
padding: 1% 0;
}
#keyframes rotation {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
#loadingCircle {
min-height: 77%;
min-width: 35%;
}
#wordLogo {
width: 100%;
height: 67%;
position: absolute;
top: 0;
left: 0;
/*padding: 5% 0;*/
margin-top: 5%;
}
.circle {
}
.logo {
width: 10%;
padding: 11% 0;
}
.phrase {
font-family: "Proxima Nova", sans-serif;
font-size: 24px;
font-style: oblique;
position: absolute;
/* top: 625px; */
margin-left: 50%;
/* text-align: center; */
transform: translateX(-50%);
}
(Added 3:58 pm on 6/20) In addition, I need to make sure the circle doesn't alter its shape and become an oval like it did here when I changed my solution to fit a suggested answer:
Added at 8:19 a.m. on 6/21/18The circle no longer becomes an oval! However, nothing is centered now.
Update as of 9:24 am
We're getting closer!!
1) I realize that I probably should pick a certain ratio of the size of the logo to the size of the spinner to use so that the logo doesn't get so small on mobile versions. I'm searching the web for ideas, but if you know of one particularly fitting for this project, let me know!
2) Now we need to get the phrases under the spinner, rather than out to the side.
Update 3
Bring the phrase out of the centered class like this:
<div id="centered">
<div id="animatedLogo">
<div id="loadingCircle">
<img id="loadingLogo" src="../Content/images/HCSS_GooglePresentation_Spinner_Green.PNG" class="circle" />
</div>
</div>
<div id="wordLogo">
<img id="HCSSLogo" src="../Content/images/hcss logo2.jpg" class="logo" />
</div>
</div>
<div id="myPhrase" class="phrase">phrase phrase phrase phrasephrase</div>
Then in the css change this:
.phrase {
font-family: "Proxima Nova", sans-serif;
font-size: 4vmin;
font-style: oblique;
position: absolute;
bottom: 20px;
width: 100%;
left: 50%;
height: 10%;
text-align: center;
transform: translateX(-50%);
}
To change things on smaller screens use media query:
#media only screen and (max-width: 767px) {
.someClass {
color: red;
}
}
Update 2
Okay, I tested things out and this should work:
html:
<div id="centered">
<div id="animatedLogo">
<div id="loadingCircle">
<img id="loadingLogo" src="../Content/images/HCSS_GooglePresentation_Spinner_Green.PNG" class="circle" />
</div>
</div>
<div id="wordLogo">
<img id="HCSSLogo" src="../Content/images/hcss logo2.jpg" class="logo" />
</div>
<div id="myPhrase" class="phrase"></div>
</div>
css:
#centered {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
#wordLogo {
position: absolute;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
/* height: 67%; */
/* position: absolute;
top: 0;
left: 0; */
/*padding: 5% 0;*/
/* margin-top: 5%; */
}
update
Try this out if flexbox is not working:
#loadingCircle, #wordLogo {
position: relative;
}
#loadingCircle img, #wordLogo img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Try using flexbox:
#loadingCircle, #wordLogo {
display: flex;
justify-content: center;
align-items: center;
}
Let me know if it works or not.

Calculating hamburger object bar position

I have this hamburger I'm creating. I'm trying to understand how to position the bars with precise calculation without eyeballing it. The hamburger height is 24px
so I would assume in order to position the middle bar it would be half the height so 12px(top: 12px;) or incase of the example 0.5em but that doesn't look centered to the overall menu. (top: 10px looks right or 0.625em).
Overall whats a better way to calculate anything in css?
http://codepen.io/anon/pen/Bjjqez
<div class="hamburger">
<div class="hamburger__top"></div>
<div class="hamburger__middle"></div>
<div class="hamburger__bottom"></div>
</div>
SASS
.hamburger {
position: relative;
width: 3em;
height: 1.5em;
cursor: pointer;
div {
background-color: red;
position: absolute;
width: 100%;
height: .25em;
}
&__top {
top: 0;
}
&__middle {
background-color: green;
top: 0.5em;
}
&__bottom {
bottom: 0;
}
}
Flexbox can do that....no positioning required.
Here's a couple of options.
.hamburger {
width: 3em;
height: 1.5em;
cursor: pointer;
display: flex;
flex-direction: column;
margin: 1em auto;
}
.hamburger div {
background-color: red;
height: .25em;
}
.around {
justify-content: space-around;
background: lightblue;
}
.between {
justify-content: space-between;
background: lightgreen;
}
<div class="hamburger around">
<div class="hamburger__top"></div>
<div class="hamburger__middle"></div>
<div class="hamburger__bottom"></div>
</div>
<div class="hamburger between">
<div class="hamburger__top"></div>
<div class="hamburger__middle"></div>
<div class="hamburger__bottom"></div>
</div>
Replace your top: 0.5em with:
top: 50%;
transform: translateY(-50%);
From my understanding of how this works, the top: 50% will move the top of the element to be half way down. The translateY(-50%) will then move the element up by half it's own height, and therefore centrally position it.
Example: http://codepen.io/anon/pen/RrrqWP