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 8063813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:09:58+00:00 2026-06-05T11:09:58+00:00

I have a web page that I’m generating, where there is a h2 with

  • 0

I have a web page that I’m generating, where there is a h2 with a green background labeling a table. The table can have any number of columns and I would like the h2 element to extend horizontally as far as the user can scroll, so that there is always a green bar above the table. The effect I’m trying to achieve is a green bar that spans at least the width of the table, so that it is always directly above the table, no matter how far the user scrolls.

Here is what it currently looks like (the red outline shows approximately the edges of the containing html, body, and div elements):
Screenshot
And here are the relevant pieces of code:

css:

h2 {
    font-family:Arial;
    font-size:20pt;
    color:#FFFFFF;
    text-align:left;
    font-weight:normal;
    background-color:#00693C;
    clear: both;
    padding:2px;
    margin: 0px;
}
table.response {
    border:1px outset;
    border-collapse: separate;
}
table.response td {
    font-size: 14px;
    padding: 3px;
    border:1px inset;
}

html:

<h2>[snip]</h2>
<table class="response">
  <tbody>
    <tr>
      <td>[snip]</td>
      [...]
    </tr>
    [...]
  </tbody>
</table>

Things I have tried already that haven’t worked:

  1. A <thead> element containing a single <tr> and a single <th> where the colspan on the <th> is set to the number of columns in the table. This works for smaller numbers of columns, but for larger tables (for example, with colspan=”6000″), some browsers (specifically, Firefox 11) render the cell (and its background) as only taking up one column.
  2. A <thead> element containing a single <tr> and one <th> with colspan=”2″ and the background-color CSS property set for the <tr> element. Using Firefox’s Inspect Element feature, it showed that the <tr> spanned the entire width of the table, but the background was only applied to the one cell.
  3. A <thead> element containing a single <tr> and one <th> with colspan=”2″ and another <th> for every remaining column of the table. I tried to remove the separation between cells on the <thead>, but I was unable to.

My question is this: Is there a way to achieve the effect of having the green bar extend at least the entire width of the table, and if so, what is it? I would prefer not to use JavaScript or have to generate style code when I generate the HTML for the table.

  • 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-05T11:10:00+00:00Added an answer on June 5, 2026 at 11:10 am

    Add float: left or display: inline-block to the element that contains the table and h2.

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

Sidebar

Related Questions

I hope someone can offer any help!! I have web page that initiates a
I have a web page that lists a number of companies from a MYSQL
I have a web page that uses a large image for its background. I
I have a web page that displays comments, and users can click a 'Flag'
I have a web page that I created with html tags(form and table) and
I have a web page that contains two textboxes and a button. I can't
I have a web page that has an HTML table generated by an ASP.NET
I have a web page that shows a table of data. My page has
I have web forms page that has 2 controls. A gridview and an associated
I have a web page that lists open jobs at a company, in the

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.