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

  • Home
  • SEARCH
  • 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 118649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:31:41+00:00 2026-05-11T03:31:41+00:00

Ok, I had a simple layout problem a week or two ago. Namely sections

  • 0

Ok, I had a simple layout problem a week or two ago. Namely sections of a page needed a header:

+---------------------------------------------------------+ | Title                                            Button | +---------------------------------------------------------+ 

Pretty simple stuff. Thing is table hatred seems to have taken over in the Web world, which I was reminded of when I asked Why use definition lists (DL,DD,DT) tags for HTML forms instead of tables? Now the general topic of tables vs divs/CSS has previously been discussed, for example:

  • DIV vs Table; and
  • Tables instead of DIVs.

So this isn’t intended to be a general discussion about CSS vs tables for layout. This is simply the solution to one problem. I tried various solutions to the above using CSS including:

  • Float right for the button or a div containing the button;
  • Position relative for the button; and
  • Position relative+absolute.

None of these solutions were satisfactory for different reasons. For example the relative positioning resulted in a z-index issue where my dropdown menu appeared under the content.

So I ended up going back to:

<style type='text/css'> .group-header { background-color: yellow; width: 100%; } .group-header td { padding: 8px; } .group-title { text-align: left; font-weight: bold; } .group-buttons { text-align: right; } </style> <table class='group-header'> <tr>   <td class='group-title'>Title</td>   <td class='group-buttons'><input type='button' name='Button'></td> </tr> </table> 

And it works perfectly. It’s simple, as backward compatibile as it gets (that’ll work probably even on IE5) and it just works. No messing about with positioning or floats.

So can anyone do the equivalent without tables?

The requirements are:

  • Backwards compatible: to FF2 and IE6;
  • Reasonably consistent: across different browsers;
  • Vertically centered: the button and title are of different heights; and
  • Flexible: allow reasonably precise control over positioning (padding and/or margin) and styling.

On a side note, I came across a couple of interesting articles today:

  • Why CSS should not be used for layout; and
  • Tables vs CSS: CSS Trolls begone

EDIT: Let me elaborate on the float issue. This sort of works:

<html>   <head>     <title>Layout</title>     <style type='text/css'>       .group-header, .group-content { width: 500px; margin: 0 auto; }       .group-header { border: 1px solid red; background: yellow; overflow: hidden; }       .group-content { border: 1px solid black; background: #DDD; }       .group-title { float: left; padding: 8px; }       .group-buttons { float: right; padding: 8px; }     </style>   </head>   <body>     <div class='group-header'>       <div class='group-title'>This is my title</div>       <div class='group-buttons'><input type='button' value='Collapse'></div>     </div>     <div class='group-content'>       <p>And it works perfectly. It's simple, as backward compatibile as it gets (that'll work probably even on IE5) and it just works. No messing about with positioning or floats.</p>       <p>So can anyone do the equivalent without tables that is backwards compatible to at least FF2 and IE6?</p>       <p>On a side note, I came across a couple of interesting articles today:</p>     </div>   </body> </html> 

Thanks to Ant P for the overflow: hidden part (still don’t get why though). Here’s where the problem comes in. Say I want the title and button to be vertically centered. This is problematic because the elements are of different height. Compare this to:

<html>   <head>     <title>Layout</title>     <style type='text/css'>       .group-header, .group-content { width: 500px; margin: 0 auto; }       .group-header { border: 1px solid red; background: yellow; overflow: hidden; }       .group-content { border: 1px solid black; background: #DDD; }       .group-header td { vertical-align: middle; }       .group-title { padding: 8px; }       .group-buttons { text-align: right; }     </style>   </head>   <body>     <table class='group-header'>     <tr>       <td class='group-title'>This is my title</td>       <td class='group-buttons'><input type='button' value='Collapse'></td>     </tr>     </table>     <div class='group-content'>       <p>And it works perfectly. It's simple, as backward compatibile as it gets (that'll work probably even on IE5) and it just works. No messing about with positioning or floats.</p>       <p>So can anyone do the equivalent without tables that is backwards compatible to at least FF2 and IE6?</p>       <p>On a side note, I came across a couple of interesting articles today:</p>     </div>   </body> </html> 

which works perfectly.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T03:31:42+00:00Added an answer on May 11, 2026 at 3:31 am

    There is nothing wrong with using the tools that are available to you to do the job quickly and correctly.

    In this case a table worked perfectly.

    I personally would have used a table for this.

    I think nested tables should be avoided, things can get messy.

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

Sidebar

Ask A Question

Stats

  • Questions 165k
  • Answers 165k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Categories extend the original class, but they don't subclass it,… May 12, 2026 at 12:54 pm
  • Editorial Team
    Editorial Team added an answer Haven't tested this, but it's something like: RewriteRule \.php$ -… May 12, 2026 at 12:54 pm
  • Editorial Team
    Editorial Team added an answer "0:0:0:0:0:0:0:1" is the IPv6 loopback address as defined in RFC… May 12, 2026 at 12:54 pm

Related Questions

Ok I had asked a question recently based on this. But I need to
I recently wrote a program that used a simple producer/consumer pattern. It initially had
I had no luck with this question so I've produced this simple-as-possible-test-case to demonstrate
I have a very simple holding page I built centering a div, anchor and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.