C. Lagos
C. Lagos

Reputation: 21

Creating Footer HTML/CSS - Not Working

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.

Upvotes: 0

Views: 235

Answers (4)

Johannes
Johannes

Reputation: 67748

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;
 }

Upvotes: 0

Daebak
Daebak

Reputation: 419

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>

Upvotes: 0

Yuri Pereira
Yuri Pereira

Reputation: 1995

Use display:inline; in your .footer

Upvotes: 0

Ankur Pathak
Ankur Pathak

Reputation: 39

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..

Upvotes: 1

Related Questions