Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css layout help - 3 column footer

Tags:

css

I'm trying to get the footer in my site to look like this:

Wilgrove Baptist Church             Home | About | Ministries            1234 S. Main st.
John G. Smith, Sr. Pastor              Contact Us | Site Map           somwhere, ID 55555

My problem is getting it laid out into the 3 columns. Any suggestions?

Thanks!

like image 683
Micah Avatar asked Jan 20 '09 20:01

Micah


People also ask

How do you add a footer in three columns?

On the Insert tab, in the Header & Footer group, click Footer. You will see some pre-formatted header options. Select Blank (Three Columns). The footer is displayed with 3 placeholders on the left,centre, and right.

How do you make a 3 column grid in CSS?

By using grid-template-columns: repeat(3, 1fr) on grid container you will get layout with 3 columns of equal width, and grid layout will by default make all items in each row equal height. Save this answer.

How do I make a column footer?

You can also right-click a cell in the Table Layout area and click Add > Columns To > Footer. The Add Columns to Footer dialog box appears. Type the number of columns to add in the Count text box. Click OK.

How do I style a footer in CSS?

The trick is to set the main part of your document to have a min-height of 100%. This element must contain everything else on your page. In my example, I used the main element for this. Next, give this element a negative margin equal to the height of the footer.


2 Answers

I used the following code on my own site.

HTML:

<footer>
    <aside class="footer-left">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit.
    </aside>

    <aside class="footer-right">
        Aenean elit ante, ultrices ac vestibulum id, tempor id nisi.
    </aside>

    <aside class="footer-center">
        Integer tincidunt, sem at placerat ullamcorper, urna felis condimentum justo.
    </aside>
</footer>

CSS:

footer [class ^= 'footer-'] {
    width: 33.3333%;
    display: inline-block;
    text-align: center;
}

footer .footer-left {
    float: left;
}

footer .footer-right {
    float: right;
}

All content will be center-aligned because that's what I wanted. You can easily change this, though.

like image 198
shea Avatar answered Oct 25 '22 08:10

shea


Quite easily done using floats:

<div id="footer">
    <p class="left">Left aligned text here<br />Next line here</p>
    <p class="right">Right aligned text here<br />Next line here</p>
    <p class="centered">Center Text here<br />Next line here</p>
</div>

and the CSS:

.left{
text-align:left;
float:left;
}
.right{
float:right;
text-align:right;
}
.centered{
text-align:center;
}
like image 39
Jayx Avatar answered Oct 25 '22 09:10

Jayx