Josh Dempsey
Josh Dempsey

Reputation: 253

How to create multiple columns in a div

I was wondering how I would create multiple columns in a div. It's for a footer and I want a site map, links to social media etc.

I was going to use <multicol> but I then read that it was deprecated so it kind of put me off using it.

Basically I have an 80% wide DIV and I need three columns in it. Preferably each with a margin.

Css:

 div.bottom
        {
            height: 200px;
            width: 80%;
            margin-left: auto;
            margin-right: auto;
            margin-top: none;
            margin-bottom: none;
            border-top: 4px solid #00ccff;
            border-bottom-left-radius: 15px;
            border-bottom-right-radius: 15px;
            background-color: #575757;
        }

I just need the HTML now. Thank you for your time.

Upvotes: 20

Views: 101745

Answers (1)

Czechnology
Czechnology

Reputation: 14992

Create three divs with float: left; (or right) and give them an exact width.

<div class="bottom">
  <div style="float: left; width: 33%;"></div>
  <div style="float: left; width: 33%;"></div>
  <div style="float: left; width: 33%;"></div>
</div>

See it in action.

Upvotes: 46

Related Questions