cRolson.net
Menu
  • Home
  • Blog
  • e-Store
    • Tablets
    • Electric Tools
  • Home
  • Blog
  • e-Store
    • Tablets
    • Electric Tools

Two column posts with CSS


By Chad Olson | July 11, 2014 | Category Tutorials, WordPress

In today’s WordPress tutorial I will show you how to create a two column blog post. We will be using css. It looks well and also works great with mobile devices.

To create a two column post you can use the float option of css. We will first add some css to the beginning of the post. Create an new post and go to the text editor. We will want to use the text tab and not the Visual. Don’t be tempted to click on the visual editor as WordPress likes to delete your css code when you switch.

Add the style tag.   <style></style> In the style tag we will  create two containers. Note WordPress auto formats the posts; for this to work you will have to disable the auto format. You can either do this in your theme if it supports it or place every thing in a set of raw tags. It will give you raw html to work with. <raw><style></style>post text</raw>. Don’t forget to close the raw tag at the end of your page.

<style>
#column1 {float:left; width:300px; heigth:auto; margin-left:auto; margin-right:auto;}

#column2 {float:right; width:300px; heigth:auto; margin-left:auto; margin-right:auto;}
</style>

Note in the css code column 1 floats left while column 2 floats right. If viewed in mobile or on a smaller screen the right column will move below the left column for a one column post.
Replace width:300px; with whatever you want so it fits nice on the page.

Next we will create the html needed to create the two columns. We will use the <div> tag for the columns. Create these two carrots below.

<div id=”column1″></div>

<div id=”column2″></div>

Place your content for each column in between the div tag and it’s corresponding closing tag.

<div id=”column1″>This is my text for column1</div>

<div id=”column2″>This is my text for column2</div>

This is my text for column1
This is my text for column2

 

That is all you have to do to get two columns in a WordPress post.
You can add text images video player or any other html to each column.

Tags: how to, tutorial, two column post, WordPress, WordPress post

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts


  • My Arch Linux Multimedia Problems Solved
  • What Linux Distro Should I Use

Recent Comments


    Archives


    • July 2014
    • June 2014

    Categories


    • Linux
    • Tutorials
    • Uncategorized
    • WordPress

    Meta


    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

    Recent Posts

    • My Arch Linux Multimedia Problems Solved
    • What Linux Distro Should I Use
    • Add Test
    • Two column posts with CSS
    • Categorize your Blog
    • Embed Audio with Google Drive

    Tag Cloud

    audio blog audio Categories category page embed embed audio Google Drive how to html audio post to page streaming audio player tutorial two column post WordPress WordPress post

    Pages

    • Blog
    • Contact Us
    • Custom Computers
    • e-Store
    • Electric Tools
    • Home
    • New
    • Word Press Hosting

    Categories

    • Linux
    • Tutorials
    • Uncategorized
    • WordPress

    Copyright © 2015 cRolson.net

    Theme created by PWT. Powered by WordPress.org