Footer does not follow site layout and is not responsive

Asked

Viewed 131 times

2

Everybody, good afternoon, everybody.

I’m having difficulty making the footer responsive, it does not follow the page. Can you help through this code I made? (I tried to implement some tips I found around here but it didn’t work)

Grateful.

/*Edição do rodape (Footer)*/
footer {
	background-image: url(../img/fundo-rodape.png);
	clear: both;
	padding: 20px 0;
}

footer .container {
	position: relative;
	width: 900px;
}

.social{
	position: absolute;
	top: 12px;
	right: 0;
}

.social li{
	float: left;
	margin-left: 25px;
}

.social a{
	/*tamanho da imagem*/
	height: 32px;
	width: 32px;
	
	/*image replacement*/
	display: block;
	text-indent: -9999px;
}

.social a[href*="facebook.com"]{
	background-image: url(../img/facebook.png);
}

.social a[href*="twitter.com"]{
	background-image: url(../img/twitter.png);
}

.social a[href*="plus.google.com"]{
	background-image: url(../img/googleplus.png);
}
/*Edição do rodape (Footer)*/
 <footer>
            <!-- Conteúdo do rodapé --> 
			
			<div class="container">
				<img src="img/logo-rodape.png" alt="Logo Mirror Fashion">
				
				<ul class="social">
					<li><a href="http://facebook.com/mirrorfashion">Facebook</a></li>
					<li><a href="http://twitter.com/mirrorfashion">Twitter</a></li>
					<li><a href="http://plus.google.com/mirrorfashion">Google+</a></li>
				</ul>
				
			</div>
 </footer>

1 answer

0


Is because you set a fixed width on <div class="container">, so it will never track the width of the screen, because it will always have the width of 900px.

Instead of putting width: 900px;, change to width: 100%; and put max-width: 900px; and width: 100%; in the <footer>:

footer {
    background-image: url(../img/fundo-rodape.png);
    clear: both;
    padding: 20px 0;
   background-color: red;
    max-width: 900px;
   width: 100%;
}

footer .container {
    position: relative;
   width: 100%;
}

Example:

/*Edição do rodape (Footer)*/
footer {
	background-image: url(../img/fundo-rodape.png);
	clear: both;
	padding: 20px 0;
   background-color: red;
	max-width: 900px;
   width: 100%;
}

footer .container {
	position: relative;
   width: 100%;
}

.social{
	position: absolute;
	top: 12px;
	right: 0;
}

.social li{
	float: left;
	margin-left: 25px;
}

.social a{
	/*tamanho da imagem*/
	height: 32px;
	width: 32px;
	
	/*image replacement*/
	display: block;
	text-indent: -9999px;
}

.social a[href*="facebook.com"]{
	background-image: url(../img/facebook.png);
}

.social a[href*="twitter.com"]{
	background-image: url(../img/twitter.png);
}

.social a[href*="plus.google.com"]{
	background-image: url(../img/googleplus.png);
}
/*Edição do rodape (Footer)*/
<footer>
            <!-- Conteúdo do rodapé --> 
			
   <div class="container">
      <img src="img/logo-rodape.png" alt="Logo Mirror Fashion">
      
      <ul class="social">
         <li><a href="http://facebook.com/mirrorfashion">Facebook</a></li>
         <li><a href="http://twitter.com/mirrorfashion">Twitter</a></li>
         <li><a href="http://plus.google.com/mirrorfashion">Google+</a></li>
      </ul>
      
   </div>
</footer>

  • Right, I took fixed width and was ok when running on mobile, but desktop continues, the margin exceeds the layout, understand?

  • I edited the answer. See if that’s it.

  • Now the footer is in the correct size, but it still doesn’t line up. I can’t post a photo but I’ll try to explain. My site has a 940px standard (this pattern was requested), so it does not occupy 100% of the screen, the footer is now fixed correctly at the bottom and the correct size, but it distorts the page due to not centralize together with the rest of the layout. Do you understand? I thank you for your help.

  • Puts margin: 0 auto; on the footer.

  • Dude, I was gonna comment on this now, a friend suggested this too and it worked. I really appreciate the help. Thanks !!!

  • Ball show!!!

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.