CSS footer layout issue

I am trying to create a footer with multiple browsers that is equal in width to each other but not going beyond the 900px main body. This code does not do this ??

html
<div id="footer">
    <p class="left">About<br />Contact<br />Next line here</p>
    <p class="right"> does not evaluate or guarantee the accuracy</p>
<p class="centered">Terms<br />Privacy<br />Disclaimer</p>
</div>

css
 #footer  {
  color: #ffffff;
  width:100%;
  background: #111;
  clear: both;
  overflow: auto;   
   } 

.left {
text-align:left;
float:left;
}

.right{
float:right;
text-align:right;
}

.centered{
text-align:center;
}  
+3
source share
4 answers

The easiest solution that I see with your current premium:

#footer {
    width: 900px;
}
#footer > p {
    width: 30%;
    display: block;
    float: left;
}

p:nth-child(odd) {
    background-color: #ccc;
}

JS Fiddle demo .


Edited to offer a small revision, since your footer divappears as a list of links to other content, I would suggest changing your markup as a suggested guide: / p>
<div id="footer">
    <ul>
        <li>menu one
            <ul>
                <li>About</li>
                <li>Contact</li>
                <li>Next line here</li>
            </ul></li>
        <li>menu two
            <ul>
                <li>Does not evaluate, or guarantee the accuracy</li>
            </ul></li>
        <li>menu three
            <ul>
                <li>Terms</li>
                <li>Privacy</li>
                <li>Disclaimer</li>
            </ul></li>
    </ul>
</div>

And CSS:

#footer {
    width: 900px;
    overflow: hidden;
}

#footer > ul {
    width: 100%;
}

#footer > ul > li {
    width: 30%;
    display: block;
    float: left;
    font-weight: bold;
}

#footer > ul > li > ul {
    font-weight: normal;
}

JS Fiddle demo .

+1
source

Try the following:

    <div id="footer">
    <div class="left">About<br />Contact<br />Next line here</div>
    <div class="right"> does not evaluate or guarantee the accuracy</div>
<div class="centered">Terms<br />Privacy<br />Disclaimer</div>
</div>

for your htmll and this is for your styles:

#footer  {
  color: #ffffff;
  width:100%;
  background: #111;
 overflow: auto;   
   } 
#footer div {
 width:33%;   
}
.left {
text-align:center;
float:left;
}

.right{
float:right;
text-align:center;
}

.centered{
text-align:center;
    float:left;
}  

: http://jsfiddle.net/kLqZP/9/

+1

HTML

>   <div id="footer">
>         <p class="left">About<br />Contact<br />Next line here</p>
>         <p class="centered">Terms<br />Privacy<br />Disclaimer</p>
>         <p class="right"> does not evaluate or guarantee the accuracy</p>
>     
>     </div>
>     
>     css
>      #footer  {
>       color: #ffffff;
>       width:100%;
>       background: #111;
>       clear: both;
>       overflow: auto;   
>        } 
>     
>     .left {
>     text-align:left;
>     float:left;
>     }
>         .centered{
>     text-align:center;
>     float:left;  }
> 
>     .right{
>     float:left;
>     text-align:right;
>     }

float , div. ,

+1

If you put your own <p>, they will use their width from their content, they will not have the same size. And BTW, perhaps, divmay be a better option for this task than<p>

0
source

All Articles