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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:17:26+00:00 2026-05-31T01:17:26+00:00

I have a div containing multiple tables. Depending on the class of the div

  • 0

I have a div containing multiple tables. Depending on the class of the div I want them to be hidden or visible. Code is something like this

HTML

<div id="div-handle" class="show-first">
  <table class="table-css first-table">
    ...............
  </table>
  <table class="table-css second-table">
    ...............
  </table>
</div>

CSS

.table-css{ 
    border-collapse:collapse;
    margin:0;
    padding:0;
    text-align:left;
    width:100%;
}

.show-first .first-table{ display:block; }
.show-first .second-table{ display:none; }

.show-second .first-table{ display:none; }
.show-second .second-table{ display:block; }

JS – jQuery

$('#some-link').click(function(){ 
    $('#div-handle').removeClass().addClass('show-second');
});

What I notice is that after the class is set that the table that is shown no longer has 100% width, it’s just a normal table.

So far I noticed this in FF and Chrome (newest v), but not in IE9. In IE9 the table is still 100%.

  • 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-05-31T01:17:27+00:00Added an answer on May 31, 2026 at 1:17 am
    .show-second .second-table{ display:block; }
    

    If you are setting the display property of a table, then you want to set it to table:

    .show-second .second-table{ display:table; }
    

    There are also: table-row and table-cell if you need to display those types of elements: https://developer.mozilla.org/en/CSS/display

    Here is a demo: http://jsfiddle.net/jasper/NnCPU/ (Notice that I used .toggleClass() instead of .addClass()/.removeClass() so the link event handler can be used over and over)

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

Sidebar

Related Questions

I have a div containing an event I want it to look like this
I have a div, containing text and a few links. I want to trigger
I have a div containing several other divs with setting float:left. Now I want
I have an HTML string containing multiple <image> tags. I'd like to search for
I have a div containing a span and I want the span to vertically
I have a DIV containing text. Previously I just tried setting new HTML like
I have div containing multiple divs and text. The inner divs are alternately floated
I've looked everywhere and haven't found something useful. I have a div containing elements
I have a div containing some text. This div used to be position:fixed ,
I have a scrolling div containing list items. I have this boilerplate scroll event

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.