0

I'm trying to create a footer with 2 classes but for some reason they are not in the same line as each other. I've tried everything and I have no idea what the issue is. There is also additional white space below the footer. I want the footer to be a fixed height and keep the 2 elements on the same line (Copyright is centered and the icons are to the right). Can someone please help?

HTML:

    <footer>

    <div class="footer">

        <div class="copyright">Copyright</div>

        <div class="social-icons-footer">
            <ul>
                <li><a href="#" target="_blank"><i class="fa fa-instagram" style="font-size:30px"></i></a></li>
                <li><a href="#" target="_blank"><i class="fa fa-facebook" style="font-size:30px"></i></a></li>
                <li><a href="#" target="_blank"><i class="fa fa-twitter" style="font-size:30px"></i></a></li>
                <li><a href="#" target="_blank"><i class="fa fa-linkedin" style="font-size:30px"></i></a></li>
            </ul>
       </div>
    </div>


</footer>

CSS:

   footer {
   clear: both;
   position: relative;
   width: 100%;
   height: 60px;
   background-color: black;
          }

   footer .copyright {
   text-align: center;
   padding: 12px;
   font-size: 12px;
   color: white;
       }


   footer .social-icons-footer ul {
   list-style: none;
   float: right;
        }

   footer .social-icons-footer li {
   display: inline-block; 
        }

   .social-icons-footer ul a {
   color: white;
   margin: 14px;
   }

   .social-icons-footer ul a:hover {
   color: grey;
    }

Currently, it looks like this Image - I want copyright to be in the center and the social icons to be to the right on the SAME line.

2
  • 1
    What is not in the same line? Can you put a jsfiddle link? or some kind of illustration to show what you have and what you are trying to achieve? Commented Sep 14, 2016 at 23:13
  • What is the purpose of the div .footer? Commented Sep 14, 2016 at 23:25

4 Answers 4

1

You didn't set the div's to be inline

Add this code to your CSS div.footer div{ display: inline;} And also remove height:60px from footer properties if not necessary..

Sign up to request clarification or add additional context in comments.

1 Comment

I believe display:inline-block would be more appropriate, but otherwise ou are correct.
0

http://codepen.io/anon/pen/KgzvrY

The changed settings are (in addition to the other settings):

footer {
   line-height: 60px;
 }
footer .social-icons-footer ul {
   position: absolute;
   top: 0px;
   right: 12px;
   margin: 0;
 }
footer .social-icons-footer li {
   line-height: 0px;
 }

3 Comments

there's actually white space at the bottom, any idea why?
Probably because of the default body margin. Try to add body, html: { margin: 0; }
I added overflow: hidden; and that seemed to do the trick. Thanks!
0

Use display:inline; in your .footer

Comments

0

Check if this can be ok for you I cut most unusefull css.

.footer {width:100%;height:30px;line-height:30px;}
.copyright {width:50%;float:left;}
.social-icons-footer {width:50%;float:left;}
.social-icons-footer ul {text-align:right;margin: 0;padding: 0;list-style-type: none;}
.social-icons-footer ul li {display:inline;padding:0px 5px;}
<link media="screen" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
<footer>

    <div class="footer">

        <div class="copyright">Copyright</div>

        <div class="social-icons-footer">
            <ul>
                <li><a href="#" target="_blank"><i class="fa fa-instagram" style="font-size:30px"></i></a></li>
                <li><a href="#" target="_blank"><i class="fa fa-facebook" style="font-size:30px"></i></a></li>
                <li><a href="#" target="_blank"><i class="fa fa-twitter" style="font-size:30px"></i></a></li>
                <li><a href="#" target="_blank"><i class="fa fa-linkedin" style="font-size:30px"></i></a></li>
            </ul>
       </div>
    </div>


</footer>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.