Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7920681
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:18:34+00:00 2026-06-03T16:18:34+00:00

Note: In some situations elements with display:table-cell; have space at the top that is

  • 0

Note:

In some situations elements with display:table-cell; have space at the top that is not padding, or margin and border-collapse:collapse; doesn’t fix it either. You need to also use vertical-align:text-top;. Another users question on the subject.

Original question

I create my template files with php and have been using 3 different sets of css rules for the columns depending on if there is 1, 2 or 3 columns. Im wondering if I can get 1 set of rules to work.

glimpse of the php idea

if($this->_data['left']!=NULL)
    echo "<div id='left'>{$this->left}</div>";
if($this->_data['right']!=NULL)
    echo "<div id='right'>{$this->right}</div>";
echo "<div id='content'>{$this->main}</div>";

#left and #right would be fixed width and to the left and right. The #main would be in center and use up the rest of the #wrappers width. so if there wasnt a #right the #main would fill the space where #right would have been.

<!-- 3 column -->
<div id='container'>
    <div id='left'></div>
    <div id='main'></div>
    <div id='right'></div>
</div>

<!-- 2 column -->
<div id='container'>
    <div id='left'></div>
    <div id='main'></div>
</div>
<!-- or -->
<div id='container'>
    <div id='main'></div>
    <div id='right'></div>
</div>

<!-- 1 column -->
<div id='container'>
    <div id='main'></div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:18:35+00:00Added an answer on June 3, 2026 at 4:18 pm

    You can use display:table property for this. Write like this:

    #container{
        display:table;
        width:100%;
    }
    #container > div{
        display:table-cell;
        height:50px;
    }
    #left, #right{
        width:100px;
        background:red;
    }
    #right{
        background:green;
    }
    #main{
        background:blue;
    }
    

    Check this http://jsfiddle.net/HXaPR/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm loading in some HTML content like this: $('#scores').load('scores.php #scores'); Note that It is
So I have this page that has some basic custom tabs: http://demo.unlockedmanagement.com/users/view/2 * NOTE
I have a Flex project that I need to work on that using some
Let's say I have an NSArray of NSDictionaries that is 10 elements long. I
Given a table of models 'A', that can have multiple child models 'B', of
I have decided that I wanted to create some custom dialog classes that could
Suppose I have a table that contain information on streaming media connections. In this
I am writing an app that in some situations warns user with an alarm
Given the following ResourceBundle properties files: messages.properties messages_en.properties messages_es.properties messages_{some locale}.properties Note: messages.properties contains
Note: This question has broadened in scope from previous revisions. I have tried to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.