FontAwesome spinning icon misplaced - html

I've tried to mimic the "icon left - text right" boxes from https://fontawesome.com/ by taking over the style sheets. everything works fine until I apply fa-spin to an icon (see the sample). The icon is then misplaced and not centered.
I was just able to fix the issue by creating a clone of .g-im-icon -> .g-im-icon-for-spin and playing around with the top, left and transform styles.
however I was wondering if there would be a generic solution that would work for both spinning and non spinning icons?
.g-im-item {
border-radius: .25rem;
box-shadow: 0 0.25rem 0.125rem 0 rgba(33, 37, 41, .05);
margin-bottom: 1.5rem;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.g-im-icon-c {
width: 25%;
font-size: 1.95312rem;
position: relative;
}
.g-im-text-c {
padding: 1.5rem;
width: 75%;
}
.g-im-title {
font-family: fa5-proxima-nova, Helvetica Neue, Helvetica, Arial, sans-serif;
margin-top: 0;
margin-bottom: .5rem;
font-weight: 600;
}
.g-im-message {
margin-top: 0;
margin-bottom: 0;
line-height: 1.5;
}
.g-im-icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet" />
<div class="g-im-item k-info-colored">
<div class="g-im-icon-c">
<i class="g-im-icon fas fa-tachometer-alt fa-2x"></i>
</div>
<div class="g-im-text-c">
<h3 class="g-im-title">Title goes here</h3>
<p class="g-im-message">Test goes here</p>
</div>
</div>
<div class="g-im-item k-info-colored">
<div class="g-im-icon-c">
<i class="g-im-icon fas fa-tachometer-alt fa-spin fa-2x"></i>
</div>
<div class="g-im-text-c">
<h3 class="g-im-title">Title goes here</h3>
<p class="g-im-message">Test goes here</p>
</div>
</div>

In your .g-im-icon-c class you could implement flexbox in order to center its items instead of using position absolute, this is happening because the transform property get overwritten by your animation.. that is why your animation isn't centered...
.g-im-item {
border-radius: .25rem;
box-shadow: 0 0.25rem 0.125rem 0 rgba(33, 37, 41, .05);
margin-bottom: 1.5rem;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.g-im-icon-c {
width: 25%;
font-size: 1.95312rem;
display: flex;
justify-content: center;
align-items: center;
}
.g-im-text-c {
padding: 1.5rem;
width: 75%;
}
.g-im-title {
font-family: fa5-proxima-nova, Helvetica Neue, Helvetica, Arial, sans-serif;
margin-top: 0;
margin-bottom: .5rem;
font-weight: 600;
}
.g-im-message {
margin-top: 0;
margin-bottom: 0;
line-height: 1.5;
}
.g-im-icon {
/*position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);*/
}
<link href="https://use.fontawesome.com/releases/v5.0.4/css/all.css" rel="stylesheet" />
<div class="g-im-item k-info-colored">
<div class="g-im-icon-c">
<i class="g-im-icon fas fa-tachometer-alt fa-2x"></i>
</div>
<div class="g-im-text-c">
<h3 class="g-im-title">Title goes here</h3>
<p class="g-im-message">Test goes here</p>
</div>
</div>
<div class="g-im-item k-info-colored">
<div class="g-im-icon-c">
<i class="g-im-icon fas fa-tachometer-alt fa-spin fa-2x"></i>
</div>
<div class="g-im-text-c">
<h3 class="g-im-title">Title goes here</h3>
<p class="g-im-message">Test goes here</p>
</div>
</div>

As an option, you can try applying negative margin to all spinning icons .fa-spin:
.fa-spin {
margin-left: -25%;
margin-top: -25%;
}

Related

The smooth scrolling isn’t working on my Html css website

below is the code for both html and css. Please I really need help with this issue and I want a solution why the scrolling effect is not working after i tried using html{
scroll-behavior: smooth;
}.....I have tried also to use some java script short codes but it is still not working. I have designed it to scroll to a specific part of the page after clicking on the menu headings
<html lang="en">
<head>
<title> Anetin Super Structures</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="images/logo (1).png">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css2?family=Kaushan+Script&family=Poppins&display=swap" rel="stylesheet">
</head>
<body>
<!--home section-->
<section id="coverphoto">
<img src="images/logomah.png" class="logo">
<div class="banner-text">
<h1 class="heading">Anetin Super Structures</h1>
<p class="paragraph">Engineering your dreams with us</p>
<div class="banner-btn">
<span></span> Find Out
<span></span> Read More
</div>
</div>
</section>
<div id="sideNav">
<nav>
<ul>
<li>HOME</li>
<li>FEATURES</li>
<li>SERVICES</li>
<li>TESTIMONIALS</li>
<li>ABOUT US</li>
</ul>
</nav>
</div>
<div id="menuBtn">
<img src="/images/menu-button.png" id="menu" >
</div>
<!--features sections-->
<section id="features">
<div class="title-text">
<p>FEATURES</p>
<h1>Why Choose Us</h1>
</div>
<div class="feature-box">
<div class="features">
<h1>Experienced Stuff</h1>
<div class="features-desk">
<div class="features-icon">
<i class="fa fa-shield"></i>
</div>
<div class="features-text">
<p>How we do it! On large scale construction our Architects normally manages the job with a construction manager and a design engineer supervising it.</p>
</div>
</div>
<h1>Pre Booking Online</h1>
<div class="features-desk">
<div class="features-icon">
<i class="fa fa-check-square-o"></i>
</div>
<div class="features-text">
<p>How we do it! On large scale construction our Architects normally manages the job with a construction manager and a design engineer supervising it.</p>
</div>
</div>
<h1>Affordable Cost</h1>
<div class="features-desk">
<div class="features-icon">
<i class="fa fa-usd"></i>
</div>
<div class="features-text">
<p>In every services that we offer we also make sure that they have affordable costs with quality work</p>
</div>
</div>
</div>
<div class="features-img">
<img src="images/feature.jpeg" >
</div>
</div>
</section>
<!--services section-->
<section id="services">
<div class="title-text">
<p>SERVICES</p>
<h1>We Provide Better</h1>
</div>
<div class="service-box">
<div class="single-service">
<img src="images/buildingN.jpeg">
<div class="overlay"></div>
<div class="service-descrip">
<h3>Construction</h3>
<hr>
<p></p>
</div>
</div>
<div class="single-service">
<img src="images/electrical eng.jpeg" >
<div class="overlay"></div>
<div class="service-descrip">
<h3>Electrical Engineering</h3>
<hr>
<p></p>
</div>
</div>
<div class="single-service">
<img src="images/Painting.jpeg" >
<div class="overlay"></div>
<div class="service-descrip">
<h3>Wall Painting</h3>
<hr>
<p>We pair you up with the ideal artist for your project. From wall paintings to wall art ideas for your office or homes - the ideas are endless.</p>
</div>
</div>
<div class="single-service">
<img src="images/pumblingN.jpeg" >
<div class="overlay"></div>
<div class="service-descrip">
<h3>Pumbling</h3>
<hr>
<p> We install, check, and replace fixtures in your home or commercial property to ensure that you obtain high-quality service and materials. Toilets, kitchen and bathroom sinks etc.</p>
</div>
</div>
<div class="single-service">
<img src="images/engineeringdrawings.jpeg" >
<div class="overlay"></div>
<div class="service-descrip">
<h3>Engineering Drawings</h3>
<hr>
<p></p>
</div>
</div>
<div class="single-service">
<img src="images/roofing.jpeg" >
<div class="overlay"></div>
<div class="service-descrip">
<h3>Roofing</h3>
<hr>
<p>Custom Roofs, Ceiling, Material, Installation, Supply and Manufacturing by our professional engineers</p>
</div>
</div>
</div>
</section>
<!--end of services section-->
<!--testimonial section-->
<section id="testimonial">
<div class="title-text">
<p>TESTIMONIALS</p>
<h1>What Client Says</h1>
</div>
<div class="testimonial-row">
<div class="testimonial-column">
<div class="user">
<img src="images/tatenda.jfif">
<div class="user-info">
<h4>TATENDA CHIKOMA <i class="fa fa-twitter"></i></h4>
<small>#taibo87</small>
</div>
</div>
<p>To say we're happy would be an understatement. When Anetin Team builds a home for you, they'll build it with care as if they were doing it for themselves and their families. Anetin Team would definitely be the one to build our next home in Southley Park, Harare.</p>
</div>
<div class="testimonial-column">
<div class="user">
<img src="images/nyasha.jfif">
<div class="user-info">
<h4> NYASHA MUGANHIRE<i class="fa fa-twitter"></i></h4>
<small>#nyaash_16!</small>
</div>
</div>
<p>I love this company. Very easy to talk to them and they really know how to save money and do quality stuff. Anetin Super Structures were great to work with, they did a complete remodel of our kitchen and two bathrooms providing best ceiling fitting and repairing the damaged water system. </p>
</div>
<div class="testimonial-column">
<div class="user">
<img src="images/lorraine.jpg">
<div class="user-info">
<h4>LORRAINE MHASHU <i class="fa fa-twitter"></i></h4>
<small>#lolo30_</small>
</div>
</div>
<p>If you need a new roof please do yourself a favour and get in touch with Anetin Super Structures. I can't say enough how awesome it was working with Anetin, they made the entire roofing beautifully i'm always grateful. </p>
</div>
</div>
</section>
<!--end of testimonial section-->
<!--footer section-->
<section id="footer">
<img src="images/brick layering.jpg" class="footer-img">
<div class="title-text">
<p>CONTACT</p>
<h1>Visit Shop Today</h1>
</div>
<div class="footer-row">
<div class="footer-left">
<h1>Opening Hours</h1>
<p><i class="fa fa-clock-o"></i>Monday to Friday - 8am to 5pm</p>
<p><i class="fa fa-clock-o"></i>Saturday and Sunday - 9am to 3pm</p>
</div>
<div class="footer-right">
<h1>Get In Touch</h1>
<p>7329 Limpopo Rd Zimre Park, Zimbabwe<i class="fa fa-map-marker"></i></p>
<p>anetinsuperstructures#gmail.com</p>
<p><i class="fa fa-phone"></i>+263 77 448 7726</p>
</div>
</div>
<div class="social-links">
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-youtube-play"></i>
<p>© 2022 Anetin Super Structures. All Rights Reserved</p>
</div>
</section>
<!--end of footer section-->
<script>
var menuBtn = document.getElementById("menuBtn")
var sideNav = document.getElementById("sideNav")
var menu = document.getElementById("menu")
sideNav.style.right== "-250px"
menuBtn.onclick= function(){
if(sideNav.style.right== "-250px"){
sideNav.style.right= "0";
menu.src="/images/cancel.png";
}
else{
sideNav.style.right="-250px";
menu.src="/images/menu-button.png"
}
}
</script>
</body>
</html>
/*CSS*/
*{
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
}
html{
scroll-behavior: smooth;
}
#coverphoto{
background: linear-gradient(rgba(0,0,0,0.5),#967300),url(../images/cover.jpeg);
background-size: cover;
background-position: center;
height: 100vh;
}
.logo{
width: 140px;
position: absolute;
top: 4%;
left: 10%;
}
.banner-text{
text-align: center;
color: #fff;
padding-top: 180px;
}
.banner-text h1{
font-size: 130px;
font-family: 'Kaushan Script', cursive;
animation: anim 2s;
}
.banner-text p{
font-size: 20px;
font-style: italic;
font-weight: 100;
animation: anim 1.5s .5s backwards;
}
#keyframes anim{
0%{
opacity: 0;
}
100%{
opacity: 1;
}
}
.banner-btn{
margin: 70px auto;
animation: anim 2s .8s backwards;
}
.banner-btn a{
width: 150px;
text-decoration: none;
display: inline-block;
margin: 0 10px;
padding: 12px 0;
color: #fff;
border: .5px solid #fff;
position: relative;
z-index: 1;
transition: color .5s;
}
.banner-btn a span{
width: 0%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: #fff;
z-index: -1;
transition: .5s;
}
.banner-btn a:hover span{
width: 100%;
}
.banner-btn a:hover{
color: black;
}
#sideNav{
width: 250px;
height: 100vh;
position: fixed;
right: -250px;
top: 0;
background: #967300;
z-index: 2;
transition: .5s;
}
nav ul li{
list-style: none;
margin: 50px 20px;
color: #fff;
cursor: pointer;
}
nav ul li a {
text-decoration: none;
}
#menuBtn{
width: 30px;
height: 25px;
background: #967300;
text-align: center;
position: fixed ;
right: 50px;
top: 30px ;
border-radius: 3px;
z-index: 3;
cursor: pointer;
}
.menu-btn img{
width: 20px;
margin-top: 15px;
}
#media screen and (max-width: 770px) {
.banner-text h1{
font-size: 44px;
}
.banner-btn a{
display: block;
margin: 20px auto;
}`enter code here`
}
/* features*/
#features{
width: 100%;
padding: 70px 0;
}
.title-text{
text-align: center;
padding-bottom: 70px;
}
.title-text p{
margin: auto;
font-size: 20px;
color: #ddb01d;
font-weight: bold;
position: relative;
z-index: 1;
display: inline-block;
}
.title-text p::after{
content: '';
width: 50px;
height: 35px;
background: linear-gradient(#ddb01d, #fff) ;
position: absolute;
top: -20px;
left: 0;
z-index: -1;
transform: rotate(10deg);
border-top-left-radius: 35px;
border-bottom-right-radius: 35px;
}
.title-text h1{
font-size: 50px;
}
.feature-box{
width: 80%;
margin:auto ;
display: flex;
flex-wrap: wrap ;
align-items: center;
text-align: center;
}
.features{
flex-basis: 50%;
}
.features-img{
margin: auto;
flex-basis: 50%;
}
.features-img img{
width: 70%;
border-radius: 10px;
}
.features h1{
text-align: left;
margin-bottom: 10px;
font-weight: 100;
color: #967300;
}
.features-desk{
display: flex;
align-items: center;
margin-bottom: 40px;
}
.features-icon .fa{
width: 50px;
height: 50px;
font-size: 30px;
line-height: 50px;
border-radius: 8px;
color: #967300;
border: 1px solid #967300;
}
.features-text p{
padding: 0 20px;
text-align: initial;
}
#media screen and (max-width: 770px) {
.title-text h1{
font-size: 35px;
}
.features{
flex-basis: 100%;
}
.features-img{
flex-basis: 100%;
}
.features-img img{
width: 100%;
}
}
#services{
width: 100%;
padding: 70px 0;
background: #efefef;
}
.service-box{
width: 80%;
display: flex;
flex-wrap: wrap;
justify-content: space-around ;
margin: auto;
}
.single-service{
flex-basis: 48%;
text-align: center;
border-radius: 7px;
margin-bottom: 20px;
color: #fff;
position: relative;
}
.single-service img{
width: 100%;
border-radius: 7px;
}
.overlay{
width: 100%;
height: 100%;
position: absolute;
top: 0;
border-radius: 7px;
cursor: pointer;
background: linear-gradient(rgba(0,0,0,0.5), #967300);
opacity: 0;
transition: 1s;
}
.single-service:hover .overlay{
opacity: 1;
}
.service-descrip{
bottom: 0;
left: 50%;
width: 80%;
position:absolute;
transform: translateX(-50%);
opacity: 0;
transition: 1s;
}
hr{
background: #fff;
height:2px ;
border: 0;
margin: 15px auto;
width: 60%;
}
.service-descrip p{
font-size: 14px;
}
.single-service:hover .service-descrip{
bottom: 40%;
opacity: 1;
}
#media screen and (max-width: 770px) {
.single-service{
flex-basis: 100%;
margin-bottom: 30px;
}
.service-descrip p{
font-size: 12px;
}
hr{
margin: 5px auto;
}
.single-service:hover .service-descrip{
bottom: 25% !important;
}
}
#testimonial{
width: 100%;
padding: 70px 0;
}
.testimonial-row{
width: 80%;
margin: auto;
display: flex;
justify-content: space-between;
align-items: flex-start;
flex-wrap: wrap;
}
.testimonial-column{
flex-basis: 28%;
padding: 10px ;
margin-bottom: 30px;
border-radius: 5px ;
box-shadow: 0 10px 20px 3px #00968814;
cursor: pointer;
transition: transform .5s;
}
.testimonial-column p{
font-size: 14px;
}
.user{
display: flex;
margin: 2px 0px;
align-items: center;
}
.user img{
width: 40px;
margin-right: 20px;
border-radius: 3px;
}
.user-info .fa{
margin-left: 10px;
color: #27c0ff;
font-size: 20px;
}
.user-info small{
color: #009688;
}
.testimonial-column:hover{
transform: translateY(-7px);
}
#media screen and (max-width: 770px){
.testimonial-column{
flex-basis: 100%;
}
}
#footer{
padding: 100px 0 20px;
background: #efefef;
position: relative;
}
.footer-row{
width: 80%;
margin: 0 auto;
display: flex ;
justify-content: space-between;
flex-wrap: wrap;
}
.footer-left, .footer-right{
padding: 10px;
margin-bottom: 20px ;
flex-basis: 45% ;
}
.footer-right{
text-align: right;
}
.footer-row h1{
margin: 10px 0;
}
.footer-row p{
line-height: 35px;
}
.footer-left .fa, .footer-right .fa{
font-size: 20px;
color: #967300;
margin: 10px;
}
.footer-img{
max-width: 370px;
opacity: 0.1;
position:absolute;
left: 50%;
top: 35%;
transform: translate(-50%, -50%);
}
.social-links{
text-align: center;
}
.social-links .fa{
height: 40px;
width: 40px;
font-size: 20px;
line-height: 40px;
border: 1px solid #967300;
margin: 40px 5px 0;
transition: .5s;
}
.social-links .fa:hover{
background: #967300;
color: #fff;
transform: translateY(-7px);
cursor: pointer;
}
.social-links p{
font-size: 12px;
margin-top: 20px;
}
#media screen and (max-width: 770px){
.footer-left, .footer-right{
flex-basis: 100%;
font-size: 14px;
}
.footer-img{
top: 25%;
}
}
I think you must ad scroll-behavior: smooth; to body selector!
You can try this:
// anhor
const menuBtn = document.getElementById("menuBtn");
menuBtn?.addEventListener('click', function(e) {
e.preventDefault();
const target = document.getElementById("some-selector");
target.scrollIntoView({ behavior: "smooth", block: "start" });
});

Why does my background-image become bigger?

I have 3 blocks that cosist of parent and child blocks. For my parent block I establish min-height: 360px;. It will help to became my block bigger when I add some text. But even if I don't add more text it becomes bigger.
How can I solve this problem without establshing to my parent block height: 360px;?
* {
padding: 0;
margin: 0;
}
body {
font-family: sans-serif;
}
.groups_line {
margin: 0 auto;
width: 1565px;
padding-right: 40px;
padding-left: 40px;
display: flex;
}
.line {
width: 520px;
min-height: 360px;
margin-right: 4px;
display: flex;
justify-content: center;
padding-top: 170px;
padding-bottom: 55px;
}
.line:last-child {
margin-right: 0px;
}
.first_group {
background-image: url(https://i.postimg.cc/X7K9PsbD/13-2x.png);
}
.second_group {
background-image: url(https://i.postimg.cc/hGvxfg7H/kaboompics-com-Woman-preparing-a-lunch-on-the-kitchen-table.png);
}
.third_group {
background-image: url(https://i.postimg.cc/s2GXk2WD/photo-1453822858805-7c095c06011e.png);
}
.wrapper_foot {
display: flex;
justify-content: space-between;
padding: 18px 15px 10px 15px;
}
.heading_block {
font-family: "Open Sans";
font-size: 14px;
font-weight: 800;
text-transform: uppercase;
color: #b59f5b;
margin: 20px 10px 15px 10px;
text-align: center;
}
.text {
color: #ffffff;
font-family: 'Josefin Sans', sans-serif;
font-size: 19px;
text-transform: uppercase;
margin-left: 55px;
margin-right: 55px;
text-align: center;
line-height: 24px;
}
.data {
opacity: 0.54;
color: #ffffff;
font-family: "Open Sans";
font-size: 12px;
font-weight: 300;
line-height: 12px;
}
.number {
opacity: 0.54;
color: #ffffff;
font-family: 'Raleway', sans-serif;
font-size: 12px;
font-weight: 400;
display: inline;
}
.fa-comment {
color: #b59f5b;
font-size: 14px;
font-family: "Font Awesome";
}
.border {
width: 465px;
min-height: 135px;
border: 3px solid #b59f5b;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.14.0/css/all.css" integrity="sha384-HzLeBuhoNPvSl5KYnjx0BT+WB0QEEqLprO+NBkkk5gbc67FTaL7XIGa2w1L0Xbgc" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght#400;500;600&family=Open+Sans:wght#600;700&family=Raleway:wght#300&display=swap" rel="stylesheet">
<div class="groups_line">
<div class="first_group line">
<div class="first-group-line border">
<p class="group_line heading_block">beauty health life</p>
<p class="group_line text">FROM GRAPEFRUIT TO LEMONS TO ORANGES, CITRUS DOES YOU GOOD!</p>
<div class="wrapper_foot">
<p class="group-line data"> June 14, 2015</p>
<div class="group-line comment_logo">
<i class="fas fa-comment"></i>
<p class="group-line number">24</p>
</div>
</div>
</div>
</div>
<div class="second_group line">
<div class="second-group-line border">
<p class="group_line heading_block">health</p>
<p class="group_line text">5 Tips To Supercharge Your
Motivation</p>
<div class="wrapper_foot">
<p class="group-line data"> June 14, 2015</p>
<div class="group-line comment_logo">
<i class="fas fa-comment"></i>
<p class="group-line number">24</p>
</div>
</div>
</div>
</div>
<div class="third_group line">
<div class="third-group-line border">
<p class="group_line heading_block">Beauty</p>
<p class="group_line text">To Keep Makeup Looking Fresh Take A Powder</p>
<div class="wrapper_foot">
<p class="group-line data"> June 14, 2015</p>
<div class="group-line comment_logo">
<i class="fas fa-comment"></i>
<p class="group-line number">24</p>
</div>
</div>
</div>
</div>
</div>
If you want to fit the text space inside the block, I suggest using min-height: fit-content

Margin makes Bootstrap 5 column exceed 100vh height

I'm trying out Bootstrap 5 with a simple webpage where I have one row with two columns. The left column is fine but the right one is acting funny. The webpage is supposed to be full screen with no scroll. But whenever I put margin in an element inside the right column then the whole column increases in height and goes beyond 100vh/100%. I want content-right-inner class to have margin of 50px all around. If I delete min-height then all item moves to the top. I want it to be full screen size with margin. How can I do that?
Here's the code:
*,
*:before,
*:after {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
line-height: 1.7;
font-size: 1.6rem;
background-color: #fff;
color: #000;
}
h1, h2, h3, h4, h5, h6, p {
margin: 0px;
}
button,
input {
overflow: visible;
}
button,
input,
optgroup,
select,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
.row>* {
padding-right: 0;
padding-left: 0;
}
.main {
background-color: green;
max-height: 100vh;
}
.content-left{
height: 100vh;
padding: 0;
color: #fff;
background-color: red;
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
}
.content-right{
background: blue;
}
.content-right-inner{
margin: 50px;
position: relative;
min-height: 100vh;
}
.logo p{
font-family: Lato-Light;
font-size: 1.5rem;
color: #F7A14C;
font-weight: 600;
}
.main-content{
position: absolute;
left: 0;
top: 50%;
bottom: auto;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.social-box{
margin: 0 10px 0px 15px;
float: left;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha1/css/bootstrap.min.css" rel="stylesheet"/>
<section class="main">
<div class="container-fluid position-relative h-auto p-0 overflow-hidden">
<div class="row">
<section class="content-left col-xs-12 col-lg-6">
<div class="inner-container">
<p>Boom Boom</p>
</div>
</section>
<section class="content-right col-xs-12 col-lg-6">
<div class="content-right-inner">
<div class="logo text-center">
<p>test</p>
</div>
<div class="main-content">
<h1>Lorem Ipsum!</h1>
<p>Lorem Ipsum Lorem Ipsum Lorem Ipsum.</p>
<p>Lorem Ipsumsdfafafafafa!</p>
<button>Lorem Ip</button>
</div>
<div class="social-icons">
<div class="social-box">
<i class="fab fa-facebook-f"></i>
</div>
<div class="social-box">
<i class="fab fa-twitter"></i>
</div>
<div class="social-box">
<i class="fab fa-linkedin-in"></i>
</div>
<div class="social-box">
<i class="fab fa-instagram"></i>
</div>
</div>
</div>
</section>
</div>
</div>
</section>
Found a fix for the issue. Putting margin all around and especially at the bottom made the container exceed it's height of 100vh. To fix it I just used calc() in .content-right-inner.
Here's the code:
.content-right-inner{
position: relative;
margin: 50px;
height: 95vh;
height: calc(100vh - 100px);
}
I guess that just deducts the extra height which came from a margin of 50px.

Paragraph Bottom Right of Div

I have two divs that each have a paragraph link at the bottom right of the div. When I add the code bottom: 0; position: absolute;, it pulls both the links together into the far right div instead of keeping them in their own divs. How can I set this so that the link stays inside of it's own container at the bottom right corner?
.header-unit {
height: 300px;
position: relative;
margin-top: 5px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-image: url("/images/liberty.jpg");
}
#messageContainer {
margin-left: 200px;
/* padding-top: 450px; */
position: relative;
display: inline-block;
}
h1 {
font-family: 'Montserrat', sans-serif;
font-size: 2em;
line-height: 1.15;
text-transform: uppercase;
}
#knowledge,
#practice {
padding: 25px;
width: 350px;
height: 300px;
display: block;
color: #fff;
}
.linksect {
bottom: 0;
right: 25px;
position: absolute;
}
#knowledge {
background: #8b8b8b;
}
#practice {
background: #554a58;
}
.indexheader {
font-family: 'Montserrat', sans-serif;
font-size: 2em;
line-height: 1.15;
text-transform: uppercase;
color: #554a58;
}
.firmvalues {
margin-top: 50px;
}
<link href="https://www.w3schools.com/w3css/4/w3.css" rel="stylesheet" />
<div class="header-unit">
<div id="messageContainer" class="w3-row">
<div id="knowledge" class="w3-col l6">
<h1>Knowledge. Experience. Commitment. </h1>
<p>The attorneys of ....</p>
<p class="linksect">Our Attorneys <span class="fa fa-angle-double-right" aria-hidden="true"></span></p>
</div>
<div id="practice" class="w3-col l6">
<h1>Practice Areas</h1>
<p>Business and Commercial Law<br> Insurance Coverage and Indemnity Law<br> Medical and Dental Malpractice<br> Probate Law and Practice<br> and more...</p>
<p class="linksect">Practice Areas <span class="fa fa-angle-double-right" aria-hidden="true"></span></p>
</div>
</div>
</div>
You can provide context for position:absolute by adding a non-static position property to the ancestor element you want the absolutely positioned element to be relative to. position:relative is usually a good choice because it keeps your element in the document flow. (Note that I added it to the #knowledge,#practice rule.)
.header-unit {
height: 300px;
position: relative;
margin-top: 5px;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-image: url("/images/liberty.jpg");
}
#messageContainer {
margin-left: 200px;
/* padding-top: 450px; */
position: relative;
display: inline-block;
}
h1 {
font-family: 'Montserrat', sans-serif;
font-size: 2em;
line-height: 1.15;
text-transform: uppercase;
}
#knowledge,
#practice {
padding: 25px;
width: 350px;
height: 300px;
display: block;
color: #fff;
position: relative;
}
.linksect {
bottom: 0;
right: 25px;
position: absolute;
}
#knowledge {
background: #8b8b8b;
}
#practice {
background: #554a58;
}
.indexheader {
font-family: 'Montserrat', sans-serif;
font-size: 2em;
line-height: 1.15;
text-transform: uppercase;
color: #554a58;
}
.firmvalues {
margin-top: 50px;
}
<link href="https://www.w3schools.com/w3css/4/w3.css" rel="stylesheet" />
<div class="header-unit">
<div id="messageContainer" class="w3-row">
<div id="knowledge" class="w3-col l6">
<h1>Knowledge. Experience. Commitment. </h1>
<p>The attorneys of ....</p>
<p class="linksect">Our Attorneys <span class="fa fa-angle-double-right" aria-hidden="true"></span></p>
</div>
<div id="practice" class="w3-col l6">
<h1>Practice Areas</h1>
<p>Business and Commercial Law<br> Insurance Coverage and Indemnity Law<br> Medical and Dental Malpractice<br> Probate Law and Practice<br> and more...</p>
<p class="linksect">Practice Areas <span class="fa fa-angle-double-right" aria-hidden="true"></span></p>
</div>
</div>
</div>

text in footer won't align to bottom center

As the title suggests I'm trying to align my text in my footer to be horizontally center and aligned to the bottom.
Having read other's solutions, I've tried to set the parent div to relative, the p element to absolute, and then bottom: 0;/vertical-align: bottom; But doesn't work.
What happens is that the text moves up into the above div and is no longer horizontally centered.
/*Section3*/
#section3 {
height: 50%;
background: #6ed3cf;
text-align: center;
padding: 0 0 0.5em;
height: 20em;
}
#section3 h2 {
font-size: 2em;
font-weight: 200;
}
#section3 i {
padding: 0.5em;
color: black;
}
/*Footer*/
#footer {
background:#fff;
color: black;
height: 10%;
font-family: 'Open Sans', sans-serif;
position: relative;
display: table;
}
#footer p {
font-size: 0.7em;
text-align: center;
position: absolute;
bottom: 0;
vertical-align: bottom;
}
<div id="section3" style="display:flex;justify-content:center;align-items:center;">
<div>
<h2>header</h2>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<p>blablablablablablablablablablablablablablablablablablablablabla</p>
<i class="fa fa-envelope fa-2x" aria-hidden="true"></i>
<i class="fa fa-linkedin-square fa-2x" aria-hidden="true"></i >
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div id="footer">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<p>text</p>
</div>
</div>
</div>
</div>
I'm a bit confused about certain properties on your components, but here's what I would do:
Remove position: absolute on your <p> element, and remove the display: table from your <footer>.
Like so:
html {
height: 100%;
box-sizing: border-box;
}
body {
position: relative;
margin: 0;
min-height: 100%;
}
/*Section3*/
#section3 {
height: 50%;
background: #6ed3cf;
text-align: center;
padding: 0 0 0.5em;
height: 20em;
}
#section3 h2 {
font-size: 2em;
font-weight: 200;
}
#section3 i {
padding: 0.5em;
color: black;
}
/*Footer*/
#footer {
background: #fff;
color: black;
height: 10%;
font-family: 'Open Sans', sans-serif;
position: absolute;
width: 100%;
bottom: 0;
}
#footer div {
height: 100%;
}
#footer .row > div {
width: 100%;
display: table;
}
#footer p {
display: table-cell;
font-size: 0.7em;
text-align: center;
bottom: 0;
vertical-align: bottom;
}
<div id="section3" style="display:flex;justify-content:center;align-items:center;">
<div>
<h2>header</h2>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<p>blablablablablablablablablablablablablablablablablablablablabla</p>
<i class="fa fa-envelope fa-2x" aria-hidden="true"></i>
<i class="fa fa-linkedin-square fa-2x" aria-hidden="true"></i >
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div id="footer">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<p>text</p>
</div>
</div>
</div>
</div>
It worked for me when i gave width:100%; to my footer property. if you do that then the text aligns itself to middle. PS, my reputation doesnt allow me to add a comment...
Please add width style for P element of #footer as following :
#footer p {
font-size: 0.7em;
text-align: center;
position: absolute;
bottom: 0;
vertical-align: bottom;
width:100%; /* added new style */
}
If you have any issue please let me know.
Thanks...
You just try this.
#footer {
background:#fff;
color: black;
height: 10%;
font-family: 'Open Sans', sans-serif;
position: relative;
display: table;
width: 100%;
text-align: center;
}
This is worked for me.
See if this solve your purpose
#section3 {
height: 50%;
background: #6ed3cf;
text-align: center;
padding: 0 0 0.5em;
height: 20em;
}
#section3 h2 {
font-size: 2em;
font-weight: 200;
}
#section3 i {
padding: 0.5em;
color: black;
}
/*Footer*/
#footer {
/* background: #fff; */
/* color: black; */
/* height: 10%; */
/* font-family: 'Open Sans', sans-serif; */
/* position: relative; */
/* display: table; */
background: #6ed3cf;
}
#footer p {
font-size: 0.7em;
text-align: center;
/* position: absolute; */
/* bottom: 0; */
/* vertical-align: bottom; */
margin-top: 0px;
}
<div id="section3" style="display:flex;justify-content:center;align-items:center;">
<div>
<h2>header</h2>
<div class="container">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<p>blablablablablablablablablablablablablablablablablablablablabla</p>
<i class="fa fa-envelope fa-2x" aria-hidden="true"></i>
<i class="fa fa-linkedin-square fa-2x" aria-hidden="true"></i >
</div>
</div>
</div>
</div>
</div>
<!-- Footer -->
<div id="footer">
<div class="container">
<div class="row">
<div class="col-md-4 col-md-offset-4">
<p>text</p>
</div>
</div>
</div>
</div>