{"id":1805,"date":"2015-08-31T16:15:27","date_gmt":"2015-08-31T16:15:27","guid":{"rendered":"http:\/\/cssreset.com\/?p=1805"},"modified":"2015-08-31T16:15:27","modified_gmt":"2015-08-31T16:15:27","slug":"cssmultiplecolumns","status":"publish","type":"post","link":"https:\/\/cssdeck.com\/blog\/cssmultiplecolumns\/","title":{"rendered":"How to display multiple columns using Divs and CSS3"},"content":{"rendered":"<p dir=\"ltr\">CSS3 has a really neat feature called multiple columns. Multiple columns are really great for splitting up text for a responsive website. They are just one of those things good web developers should use to cut down on unnecessary scripting, because the alternative is to uniquely position and style multiple &lt;div&gt; tags and separate the text yourself.<\/p>\n<p dir=\"ltr\">Using multiple columns also offers far superior flexibility when designing a website. They allow customization of the style of borders in-between the columns, the amount of columns, and nearly everything else a web designer could possibly want to change with very little scripting.<\/p>\n<p dir=\"ltr\">Here is a demo that shows how to set up a multiple column &lt;div&gt; and how to customize it.<\/p>\n<p dir=\"ltr\">To begin, create a &lt;div&gt; tag with an id of \u201ccolumnContainer\u201d and fill it with some placeholder text.<\/p>\n<p dir=\"ltr\">HTML:<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"https:\/\/lh3.googleusercontent.com\/a9nW1sewjHoes4zjx7WGaPkJkrnwZNc1rnkxfHcNnzshNO3ePaANu-gYhVagmS3ARaIymunPwnn5teZ3kR2Ja8tjrubkBeECbcb5bzOVGKL8c3cWvh5tx9ThiioouQImJMilYrY\" width=\"624px;\" height=\"187px;\" \/><\/p>\n<p>\u00a0Next specify a column count for #columnContainer in your CSS file, then add the equivalent versions for webkit based browsers and firefox.<\/p>\n<p>CSS:<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"https:\/\/lh6.googleusercontent.com\/3vpnz8tCS6ZxkaUDQrwTnQRuG16-IVM16SiWgRgHxsyEWuTnZIOkS4GWP_epr7kk1tx5eN1vQfly6bVUIQ_hio2UxZAuFGqLOdR1zH3ujRiv_W5qL-icEAjz9QKNA8uFelTJcKE\" width=\"494px;\" height=\"149px;\" \/><\/p>\n<p dir=\"ltr\">Result:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"https:\/\/lh4.googleusercontent.com\/XlKrybNLDLSHp09YkQqz9G4L2I5fX6bvtgZfcQyMPTnYP2JM4QteaJlyrlGCiy0V6Z_fMmrGMzbpfc_tBtXVZJXY77lg3uZn8xWzEEUkBRy4YMFDV8yDCUWezQmsQvT6H0PPWCg\" width=\"624px;\" height=\"149px;\" \/><\/p>\n<p>That was so easy. With barely any CSS that created responsive, column divided text! The best part is how easily it can be customized from there.<\/p>\n<p>Multiple columns provides the functionality to style dividers in between the text in a similar fashion to CSS borders. Specify the width, consistency, and color of the divider to get a finished result. We\u2019ll also add another column to better show the column-rule\u2019s effect.<\/p>\n<p dir=\"ltr\">Here is the updated CSS:<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"https:\/\/lh4.googleusercontent.com\/XytFq5LhBXIkoUgJPRJULEhXe1fqsQ95yTsu1RECisNgLMiRsRWeAuc4z-rMR2t0ngbG836-qFqU3ckb49MqdCPi_Pqs3iCtXNFsZySwd_xElFf_GunlIxneb7pjwU5PQlCnWx4\" width=\"527px;\" height=\"236px;\" \/><\/p>\n<p dir=\"ltr\">Result:<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"https:\/\/lh6.googleusercontent.com\/eEzyVEqNxdbh9-Tkpu8AONR9XKvsIxXUc6SntxUaG0-Y1x0vcNrX1gNoOZ770KSeOzPOPopLPM1SHsfGFPRnmqBHSp_IC7DrQc6Nqwz5u0JM5u_BnFri4W5Yuw87ZapdzLDY6S0\" width=\"382px;\" height=\"257px;\" \/><\/p>\n<p>\u00a0Finally, multiple columns is able to update the spacing in between each column with another simple feature. Just specify a column-gap for the text to easily change that spacing.<\/p>\n<p dir=\"ltr\">CSS:<\/p>\n<p>\u00a0<img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"https:\/\/lh6.googleusercontent.com\/SIv77N1BlIvxWpl2Pb_Ho_4qG9R87EJKPxiWJEI2HWUCv0R7qe_ku92Z6ZdARfaY_Fkr9xFURv5sNQfIBUb91afAwIOECEs8R3bvrzkt77XGE7Y6abPrZkBa0tWy3wQBIQQi89E\" width=\"514px;\" height=\"270px;\" \/><\/p>\n<p>Result:<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" loading=\"lazy\" alt=\"\" src=\"https:\/\/lh3.googleusercontent.com\/NoVlFxHq_AjA52fnt_hr5lSAixZ36TS_69ePDgWcQ1Mhxb7K9fhQS1JO0qUwvAXlBj9TkYZAy7J6h-3NwbOy8yDBinLyYb4t3gF0Ia8eHGfZiYgZvavAW3oA7jowTUpnvb-v2J4\" width=\"624px;\" height=\"192px;\" \/><\/p>\n<p dir=\"ltr\">See how easy it is to create something beautiful in just a few minutes? It is a really nice addition to CSS which every developer should use when possible.<\/p>\n<p>Here is a link to the code: https:\/\/jsfiddle.net\/MorganMeliment\/hg3reu36\/<\/p>\n<div class=\"wp-socializer wpsr-share-icons \" data-lg-action=\"show\" data-sm-action=\"show\" data-sm-width=\"768\" ><h3>Share and Enjoy !<\/h3><div class=\"wpsr-si-inner\"><div class=\"wpsr-counter wpsrc-sz-32px\" style=\"color:#000\"><span class=\"scount\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook,twitter,linkedin,pinterest,print,pdf\">0<\/span><\/span><small class=\"stext\">Shares<\/small><\/div><div class=\"socializer sr-popup sr-32px sr-circle sr-opacity sr-pad sr-count-1 sr-count-1\"><span class=\"sr-facebook\"><a rel=\"nofollow\" href=\"https:\/\/www.facebook.com\/share.php?u=\" target=\"_blank\"  title=\"Share this on Facebook\"  style=\"color: #ffffff\" ><i class=\"fab fa-facebook-f\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"facebook\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-twitter\"><a rel=\"nofollow\" href=\"https:\/\/twitter.com\/intent\/tweet?text=%20-%20%20\" target=\"_blank\"  title=\"Tweet this !\"  style=\"color: #ffffff\" ><i class=\"fab fa-twitter\"><\/i><\/a><\/span>\n<span class=\"sr-linkedin\"><a rel=\"nofollow\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=\" target=\"_blank\"  title=\"Add this to LinkedIn\"  style=\"color: #ffffff\" ><i class=\"fab fa-linkedin-in\"><\/i><\/a><\/span>\n<span class=\"sr-pinterest\"><a rel=\"nofollow\" href=\"https:\/\/www.pinterest.com\/pin\/create\/button\/?url=&amp;media=&amp;description=\" target=\"_blank\"  title=\"Submit this to Pinterest\"  style=\"color: #ffffff\" data-pin-custom=\"true\"><i class=\"fab fa-pinterest\"><\/i><span class=\"ctext\"><span data-wpsrs=\"\" data-wpsrs-svcs=\"pinterest\">0<\/span><\/span><\/a><\/span>\n<span class=\"sr-print\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Print this article \"  style=\"color: #ffffff\" ><i class=\"fa fa-print\"><\/i><\/a><\/span>\n<span class=\"sr-pdf\"><a rel=\"nofollow\" href=\"https:\/\/www.printfriendly.com\/print?url=\" target=\"_blank\"  title=\"Convert to PDF\"  style=\"color: #ffffff\" ><i class=\"fa fa-file-pdf\"><\/i><\/a><\/span><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p dir=\"ltr\">CSS3 has a really neat feature called multiple columns. Multiple columns are really great for splitting up text for a responsive website. They are just one of those things good web developers should use to cut down on unnecessary [&#8230;]<\/p>\n<p><a class=\"more-link article\" href=\"https:\/\/cssdeck.com\/blog\/cssmultiplecolumns\/\" title=\"Click to read 'How to display multiple columns using Divs and CSS3'\">Read Article<\/a><\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[61,6,36,7,8,11,43,1],"tags":[],"_links":{"self":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/1805"}],"collection":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/comments?post=1805"}],"version-history":[{"count":1,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/1805\/revisions"}],"predecessor-version":[{"id":1806,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/posts\/1805\/revisions\/1806"}],"wp:attachment":[{"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/media?parent=1805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/categories?post=1805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cssdeck.com\/blog\/wp-json\/wp\/v2\/tags?post=1805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}