Working on making my website. I'm sure this is an easy fix but I'm so stuck!
I am trying to vertically center the copyright info on the right, then the social icons on the left. But they appear to be stacked then aligned left and right.
Here's what that looks like
Please forgive the dumb question. Very new to all this, and I've done as much troubleshooting as I can. I'm hoping is a "duh" answer!
I have a footer in my index which reads like this:
#main-footer {
padding: center;
background: darken($primary-color, 10);
color: set-text-colour($primary-color);
height: 60px;
.footer_text {
text-align: right;
font-size: 17px;
}
.footer_icons {
margin-left: 5%;
text-align: center;
display: block;
width: 100px;
padding: 4px;
a {
align: left;
&:hover {
color: $secondary-color;
#include easeOut;
}
}
}
}
<footer id="main-footer">
<div class="footer_text">Copyright © 2018</div>
<div class="footer_icons">
<a href="https://www.instagram.com/beellllaa/">
<i class="fab fa-instagram fa-2x"></i>
</a>
<a href="https://www.linkedin.com/in/beellllaa/">
<i class="fab fa-linkedin fa-2x"></i>
</a>
<a href="https://www.vimeo.com/beellllaa/">
<i class="fab fa-vimeo fa-2x"></i>
</a>
</div>
</footer>
I was unable to directly use your code via codepen, so I mocked up something quick. You could quickly center vertically by using flexbox. This might require though that you use some prefixes as well. Can check it out here:
https://codepen.io/pen/?editors=1100
#main-footer {
background-color: teal;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.social {
display: flex;
}
.footer-icons {
background-color: red;
height: 10px;
width: 10px;
margin: 5px;
padding: 5px;
}
<footer id="main-footer">
<div>Copyright © 2018</div>
<div class="social">
<div class="footer-icons"></div>
<div class="footer-icons"></div>
<div class="footer-icons"></div>
</div>
</footer>
I would recommend the following:
Readjust your HTML so that your .footer_text div comes after the .footer_icons div.
Add the following lines of CSS to your #main_footer div.
display: flex;
align-items: center;
justify-content: space-between;
See the code snippet below or this codepen:
#main-footer {
padding: center;
background: darken($primary-color, 10);
color: set-text-colour($primary-color);
height: 60px;
display: flex;
align-items: center;
justify-content: space-between;
.footer_text {
text-align: right;
font-size: 17px;
}
.footer_icons {
margin-left: 5%;
text-align: center;
display: block;
width: 100px;
padding: 4px;
a {
align: left;
&:hover {
color: $secondary-color;
#include easeOut;
}
}
}
}
<footer id="main-footer">
<div class="footer_icons">
<a href="https://www.instagram.com/beellllaa/">
<i class="fab fa-instagram fa-2x">IG</i>
</a>
<a href="https://www.linkedin.com/in/beellllaa/">
<i class="fab fa-linkedin fa-2x">LI</i>
</a>
<a href="https://www.vimeo.com/beellllaa/">
<i class="fab fa-vimeo fa-2x">VI</i>
</a>
</div>
<div class="footer_text">Copyright © 2018</div>
</footer>
$primary-color:white;
$secondary-color:white;
#main-footer {
padding: center;
background: darken($primary-color, 10);
color: set-text-colour($primary-color);
height: 60px;
line-height: 60px;
.footer_text {
font-size: 17px;
line-height:60px;
float: right;
}
.footer_icons {
margin-left: 5%;
text-align: center;
display: inline-block;
width: 150px;
padding: 4px;
a {
align: left;
padding-right:10px;
&:hover {
color: $secondary-color;
}
}
}
}
i{
font-family:'FontAwesome';
}
<footer id="main-footer">
<div class="footer_icons">
<a href="https://www.instagram.com/beellllaa/">
<i class="fa fa-instagram fa-2x"></i>
</a>
<a href="https://www.linkedin.com/in/beellllaa/">
<i class="fa fa-linkedin fa-2x"></i>
</a>
<a href="https://www.vimeo.com/beellllaa/">
<i class="fa fa-vimeo fa-2x"></i>
</a>
</div>
<div class="footer_text">Copyright © 2018</div>
</footer>
This should work. .footer_text{float:right;line-height:60px;} .footer_icons{display:inline-block;}
Codepen Link : https://codepen.io/mk_dev/pen/KxbyJp
Related
i am developing my portfolio website but i came into an error can anyone just help me.
i need to make my social icons responsive.
Here The The Image For Desktop Version.
I need To make it responsive and direction to row for mobile version. Please Help Me.
As You Can See Here The Social Icons Are Not Responsive.
index.html
```
<!-- home -->
<section class="home bd-grid" id="home">
<div class="max-width">
<div class="home-content">
<div class="text-1">Hello, Myself</div>
<div class="text-2">Piyush Shrivastava</div>
<div class="text-3">And I'm a <span class="typing"></span></div>
Download CV
</div>
</div>
<div class="social">
<ul>
<li>
<div class="circle">
<i class="fa fa-facebook-f" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-instagram" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-twitter" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-youtube" aria-hidden="true"></i>
</div>
</li>
</ul>
</div>
</section>```
Styles.css
.home{
display: flex;
flex-wrap: wrap;
background: url("/img/banner.jpg") no-repeat center;
height: 100vh;
color: #fff;
min-height: 500px;
background-size: cover;
background-attachment: fixed;
font-family: 'Ubuntu', sans-serif;
}
.home .max-width{
width: 100%;
display: flex;
}
.home .max-width .row{
margin-right: 0;
}
.home .home-content .text-1{
font-size: 27px;
}
.home .home-content .text-2{
font-size: 75px;
font-weight: 600;
margin-left: -3px;
}
.home .home-content .text-3{
font-size: 40px;
margin: 5px 0;
}
.home .home-content .text-3 span{
color: #32de84;
font-weight: 500;
}
.home .home-content a{
display: inline-block;
background: #32de84;
color: #fff;
font-size: 25px;
padding: 12px 36px;
margin-top: 20px;
font-weight: 400;
border-radius: 6px;
border: 2px solid #32de84;
transition: all 0.3s ease;
}
.home .home-content a:hover{
color: #32de84;
background: none;
}
.social{
position: absolute;
top: 35%;
right: 5%;
color: #fff;
/* background-color: #ffffff; */
}
.social ul{
list-style: none;
}
.social li{
margin-bottom: 20px;
text-align: center;
}
.circle{
background-color: transparent;
border: 2px solid white;
border-radius: 200px;
height: 35px;
width: 35px;
}
.social i{
padding-top: 7px;
height: 30px;
width: 30px;
color: #ffffff;
}
#media (max-width: 947px) {
.home .home-content .text-2 {
font-size: 60px;
}
}```
Try thinking of your problem the other way around.
Layout shifts like this are much easier to deal with when working with a 'mobile first' approach. (style the mobile version and then override at a min-width media query to style the desktop version, rather than styling the desktop perfectly and then trying to fold everything down to mobile.)
I've knocked up a quick demo of what should work for you.
This is NOT a direct replication of or fix of your existing code, just a demo of the methods you could use, but hopefully from this demo and the snippets, you should understand what is happening and be able to apply some of these methods to your own code.
The method is entirely done with flex properties.
The socials are no longer absolutely positioned and the unnecessary social wrapper div is removed.
I've added border colors and padding just to more obviously show you whats happening to the box model when you resize your browser.
To view the demo, click 'run code snippet' - but make sure to then also click the 'full page' option otherwise it'd only show you the mobile layout.
Here's the JSFiddle where I created the demo incase it's useful: CLICK TO VIEW FIDDLE
.contentWrapper {
border: 1px solid pink;
padding: 10px;
}
.mainContent {
border: 1px solid blue;
padding: 10px;
}
.social {
border: 1px solid green;
padding: 10px;
}
ul {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: row;
gap: 10px;
}
.circle {
background-color: red;
border: 2px solid white;
border-radius: 200px;
height: 35px;
width: 35px;
}
#media screen and (min-width: 948px) {
.myWrapper {
display: flex;
min-height: 100vh;
flex-direction: row;
}
.contentWrapper {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center
}
.mainContent {
width: calc(100% - 55px);
max-width: 1000px;
margin: 0 auto;
}
.social {
display: flex;
flex-direction: column;
justify-content: center;
}
.social ul {
display: flex;
flex: 0 0 55px;
flex-direction: column;
}
}
<section class="myWrapper">
<div class="contentWrapper">
<div class="mainContent">
<div class="text-1">Hello, Myself</div>
<div class="text-2">Piyush Shrivastava</div>
<div class="text-3">And I'm a <span class="typing"></span></div>
Download CV
</div>
</div>
<ul class="social">
<li>
<div class="circle">
<i class="fa fa-facebook-f" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-instagram" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-twitter" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-youtube" aria-hidden="true"></i>
</div>
</li>
</ul>
</section>
To make icons in row
we can do it using #media in the approach
APPROACH
Use flexbox to make your icons in a row
and use grid to make everything in a row when you are on a big screen
you can also set width and then add margin auto to make things centre but using justify-content center is better ---> not told in this answer
<!-- home -->
<section class="home bd-grid" id="home">
<div class="max-width">
<div class="home-content">
<div class="text-1">Hello, Myself</div>
<div class="text-2">Piyush Shrivastava</div>
<div class="text-3">And I'm a <span class="typing"></span></div>
Download CV
</div>
</div>
<div class="social">
<ul class="icons"> // give class icons to make it a flexbox
<li>
<div class="circle">
<i class="fa fa-facebook-f" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-instagram" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-twitter" aria-hidden="true"></i>
</div>
</li>
<li>
<div class="circle">
<i class="fa fa-youtube" aria-hidden="true"></i>
</div>
</li>
</ul>
</div>
</section>```
***css***
.icons{
display: flex;
flex-direction: column;
justify-content: center;
}
#media screen and (min-width: 800px //your mobile screen width) {
.icons {
display: flex;
justify-content:center;
}
.home{
display:grid;
width: 100vw;
gap: 20px;
text-align:center;
grid-template-column:2fr 2fr;
}
I'm trying to use flexbox to create a responsive layout of a product list page but this code leaves a lot of whitespace to the right of the page, ive tried using justify-content:space-between but that did not work as well. Adding overflow:hidden to .container class did nothing as well.
edit:someone said it works fine on their end but this is how
my screen looks
*{
margin:0;
padding: 0;
box-sizing: border-box;
text-transform: capitalize;
text-decoration: none;
transition: all .2s linear;
}
body{
overflow-x: hidden;
}
.container{
min-height: 100vh;
display:flex;
flex-direction: row;
justify-content:center;
flex-wrap: wrap;
padding: 40px 0;
}
.card{
height:500px;
width:280px ;
overflow: hidden;
position: relative;
align-self: center;
margin: 40px;
}
.card img{
width: 100%;
height: 80%;
object-fit: cover;
}
.card .info
{
text-align: center;
line-height: 25px;
}
.card .info .stars i
{
color: gold;
padding: 10px 0;
}
.card .info .price{
font-size: 20px;
color:#f00333;
letter-spacing: 1px;
}
.card .info h3{
color: #333;
padding-top: 5px;
}
.card .discount
{
position: absolute;
top:15px;
left:15px;
height:50px;
width:50px;
display: grid;
background-color: rgba(255, 0, 0, 0.6);
color:#fff;
font-weight: bold;
border-radius: 50%;
text-align: center;
line-height: 50px;
}
.card .panel
{
position: absolute;
top:15px;
right: -50%;
width: 45px;
background: rgba(255, 255, 255, 0.644);
display: flex;
align-items: center;
flex-flow: column;
}
.card:hover .panel{
right: 15px;
opacity: 1;
}
.card button
{
position: absolute;
left:50%;
bottom: 0%;
height: 40px;
width: 140px;
border: none;
outline:none;
background: rgba(0,0,0,0.6);
color:#fff;
font-size: 15px;
font-weight: 600;
cursor: pointer;
transform: translateX(-50%);
opacity: 0;
transition-delay: .2s;
}
.card:hover button{
opacity: 1;
bottom: 25%;
}
.card button:hover{
background: (255,0,0,0.6);
}
.card .panel a{
font-size: 20px;
color: #333;
margin: 15px 0;
}
.card .panel a:hover{
color: rgba(255,0,0,0.9);
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<div class="container">
<div class="card">
<img src="assets/women1.jpeg" alt="">
<span class="discount">-20%</span>
<div class="panel">
</div>
<button>add to cart</button>
<div class="info">
<h3>women's clothing</h3>
<div class="stars">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half"></i>
</div>
<strong class="price">$100/-</strong>
</div>
</div>
<div class="card">
<img src="assets/women1.jpeg" alt="">
<span class="discount">-20%</span>
<div class="panel">
</div>
<button>add to cart</button>
<div class="info">
<h3>women's clothing</h3>
<div class="stars">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half"></i>
</div>
<strong class="price">$100/-</strong>
</div>
</div>
<div class="card">
<img src="assets/women1.jpeg" alt="">
<span class="discount">-20%</span>
<div class="panel">
</div>
<button>add to cart</button>
<div class="info">
<h3>women's clothing</h3>
<div class="stars">
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star"></i>
<i class="fa fa-star-half"></i>
</div>
<strong class="price">$100/-</strong>
</div>
</div>
</div>
It Works Fine.
In Your Browser do a hard refresh.
I hope it will do the job done.
Hard Refresh : Ctrl + F5
Click here. It are some docs on hard Refresh If you want to know more.
Or If Nothing Works use position : absolute or Bootstrap.
<body >
<div class="outer-container">
<div class="container">
<div class="header">
HOME
ABOUT
CONTACT
RESUME
</div>
<div class="big-heading">
<h2 style=color:white>
I'm Ankit Soni.
</h2>
</div>
<div class="social-media">
<a href="https://www.linkedin.com/in/ankit-soni-991495152/">
<i class="fa fa-linkedin"></i></a>
<a href="https://github.com/ankysony">
<i class="fa fa-github"></i></a>
<a href="mailto:ankit.soni.che16#iitbhu.ac.in">
<i class="fa fa-envelope"></i></a>
</div>
<div class="scrolldown">
<a href="">
<i class="fa fa-arrow-circle-down"></i>
</a>
</div>
</div>
</div>
</body>
I cannot find any type of mistake in it but my links in it are not working (no cursor pointer no redirects). Only the last one with arrow circle is working. The links under class social-media are not.
I got a part of css which is creating the error please see to it and suggest the possible way to fix error.
.outer-container .container .big-heading
{
height: 100%;
width: 100%;
display: flex;
font-size: 3em;
position: absolute;
align-items: center;
justify-content: center;
margin-top: -50px;
}
and the entire css code is below.
*
{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.outer-container
{
height: 792px;
width: 1440px;
}
h2{
font-family: sans-serif;
}
html {
background: url(../images/banner.jpg);
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
width: 100%;
overflow: scroll;
overflow-x: hidden;
}
.outer-container .container .header
{
text-align: center;
word-spacing: 100px;
padding-top: 10px;
}
.outer-container .container .header a
{
font-family: sans-serif;
text-decoration: none;
color: white;
}
.outer-container .container .big-heading
{
height: 100%;
width: 100%;
display: flex;
font-size: 3em;
position: absolute;
align-items: center;
justify-content: center;
margin-top: -50px;
}
.outer-container .container .social-media
{
height: 100%;
width: 100%;
display: flex;
position: absolute;
align-items: center;
justify-content: center;
margin-top: 20px;
}
.outer-container .container .social-media i
{
padding: 20px;
margin: 20px;
color: white;
text-shadow: 1px 1px 1px #ccc;
font-size: 30px;
}
.outer-container .container .scrolldown
{
height: 100%;
width: 100%;
display: flex;
position: absolute;
align-items: center;
justify-content: center;
margin-top: 300px;
}
.outer-container .container .scrolldown i
{
padding: 20px;
margin: 20px;
color: white;
text-shadow: 1px 1px 1px #ccc;
font-size: 50px;
}
In the header class, your href is not redirecting you anywhere, because you only specified href="#", which neither points to another page nor points to any specific id on your page. You should add your url to to navigate to another page (or, in this case maybe an id on your own page):
href="www.site.com"
Also, it seems like in the social-media class, you did not specify any text for the link, which is why they aren't showing up.
You should put some text between the opening and closing tags:
link text
Cursor: pointer is showing and working fine in your code, to get font awesome work you need to include the library of font awesome.
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<body >
<div class="outer-container">
<div class="container">
<div class="header">
HOME
ABOUT
CONTACT
RESUME
</div>
<div class="big-heading">
<h2 style=color:white>
I'm Ankit Soni.
</h2>
</div>
<div class="social-media">
<a target="_blank" href="https://www.linkedin.com/in/ankit-soni-991495152/">
<i class="fa fa-linkedin"></i></a>
<a target="_blank" href="https://github.com/ankysony">
<i class="fa fa-github"></i></a>
<a target="_blank" href="mailto:ankit.soni.che16#iitbhu.ac.in">
<i class="fa fa-envelope"></i></a>
</div>
<div class="scrolldown">
<a href="">
<i class="fa fa-arrow-circle-down"></i>
</a>
</div>
</div>
</div>
</body>
My icons look like this:
I need to create like this one:
Here is my HTML:
<aside class="social">
<span><i class="fa fa-instagram" aria-hidden="true"></i></span>
<span><i class="fa fa-facebook" aria-hidden="true"></i></span>
<span><i class="fa fa-pinterest" aria-hidden="true"></i></span>
</aside>
Here is my CSS:
aside.social a {
margin-left: 10px;
color: #fff;
font-size: 16px;
}
aside.social a span {
width: 25px;
display: inline-block;
height: 25px;
background-color: #aaa;
border-radius: 40%;
}
You don't need two separate elements, you can do that all on your a with an i.fa inside.
aside.social a {
color: #fff;
background: #aaa;
margin-left: 10px;
border-radius: 40%;
width: 25px;
height: 25px;
line-height: 25px; /* vertical alignment */
text-align: center;
font-size: 16px;
}
I would use inline-flex on that element, then you can use flex positioning to center. justify-content: center; align-items: center; will center horizontally and vertically. You can also change the border-radius to 50% for a true circle.
aside.social a {
margin-left: 10px;
color: #fff;
font-size: 16px;
text-decoration: none;
}
aside.social a span {
width: 25px;
height: 25px;
background-color: #aaa;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<aside class="social">
<span><i class="fa fa-instagram" aria-hidden="true"></i></span>
<span><i class="fa fa-facebook" aria-hidden="true"></i></span>
<span><i class="fa fa-pinterest" aria-hidden="true"></i></span>
</aside>
Try changing your code so it looks something like this
span {
display: block;
text-align: center;
line-height: 25px
}
And
a {
width: 25px;
height: 25px;
display: inline-block;
}
You can use flex:
aside.social a {
margin-left: 10px;
color: #fff;
font-size: 16px;
text-decoration: none;
}
aside.social a span {
display: inline-flex;
justify-content: center;
align-items: center;
width: 25px;
height: 25px;
background-color: #aaa;
border-radius: 40%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet"/>
<aside class="social">
<a href="https://www.instagram.com/" class="inst">
<span>
<i class="fa fa-instagram" aria-hidden="true"></i>
</span>
</a>
<a href="https://www.facebook.com" class="facb">
<span>
<i class="fa fa-facebook" aria-hidden="true"></i>
</span>
</a>
<a href="https://www.pinterest.com/" class="pint">
<span>
<i class="fa fa-pinterest" aria-hidden="true"></i>
</span>
</a>
</aside>
add this in "aside.social a span", nothing else is required:
text-align:center;
padding-top:8px;
Try adding a position: absolute; to the css
Followed by margin-left: 20px, play with the pixels a little until you're satisfied :)
footer.footer {
height: 300px;
width: 100%;
background-color: #333333;
position: relative;
}
.wrapper {} p.copyright {
color: #fff;
line-height: 40px;
font-size: 0.7em;
position: absolute;
width: 100%;
text-align: center;
bottom: 0;
}
.social {
font-size: 19px;
float: right;
color: #fff;
padding-right: 30px;
}
<footer class="footer">
<div class="wrapper">
<p class="copyright">© GROUP TITLE 2015, social media icons supposed to be there ----></p>
<div class="social">
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</div>
</div>
</footer>
How can I display my social media icons at the same level as my copyright line, (defining, at the bottom of my footer but not under it - see snippet)?
HTML
<footer class="footer">
<div class="wrapper">
<p class="copyright">© GROUP TITLE 2015</p>
<div class="social">
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</div>
</div>
</footer>
CSS
footer.footer {
height: 300px;
width: 100%;
background-color: #333333;
position: relative;
}
.wrapper {
}
p.copyright {
color: #fff;
line-height: 40px;
font-size: 0.7em;
position: absolute;
width: 100%;
text-align: center;
bottom: 0;
}
.social {
font-size: 19px;
float: right;
color: #fff;
padding-right: 30px;
}
The copyright displays at the correct position of the footer, but how can I display my social media icons on the same level (height) without setting a padding or margin?
you can try this one:
footer.footer {
height: 300px;
width: 100%;
background-color: #333333;
position: relative;
}
.wrapper {
}
p.copyright {
color: #fff;
line-height: 40px;
font-size: 0.7em;
position: absolute;
width: 100%;
text-align: center;
bottom: 0;
}
.social {
font-size: 19px;
color: #fff;
position: absolute;
right: 5%;
top: 85%;
}
DEMO HERE
.social {
font-size: 19px;
color: #fff;
position: absolute;
right: 5%;
top: 72%;
}
You can try this. I have created fiddle for it you need to change your html structure as follows. If you don't want separately arrange the social section.
<p class="copyright">© GROUP TITLE 2015,
<span class="social">social media icons supposed to be there ---->
<i class="fa fa-twitter"></i>
<i class="fa fa-facebook"></i>
<i class="fa fa-instagram"></i>
</span>
</p>
And small change in css:
.social {
font-size: 19px;
/* float: right; */
color: #fff;
padding-right: 30px;
/* width: 100%; */
height: 10px;
}
I hope this what you are looking for it.
Fiddle