[SOLVED] why 100% table width doesnt take up 100% of content area?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
TJINAK
Forum Members
Forum Members
Posts: 136
Joined: Wed Feb 22, 2006 1:01 am

[SOLVED] why 100% table width doesnt take up 100% of content area?

Post by TJINAK »

Hello,

When using a table with this code:

Code: Select all

<table cellspacing="0" cellpadding="2" width="100%" align="center" summary="" border="1">
It leaves to much room to the left and right of the table.  How can I narrow these margins down?


This is the contents of the tempalte layout in question:

Code: Select all

  {* Start Content (Navigation and Content columns) *}
   <div id="content">

      {* Start Navigation *}
      <div id="sidebar">
         <h2 class="accessibility">Navigation</h2>
         {menu template='cssmenu.tpl'}
      <hr class="accessibility" />
      </div>
      {* End Navigation *}


      {* Start Content Area, Right Column *}
      <div id="main">
         <div style="float: right;">{print showbutton=true script=true}</div>
         <h2>{title}</h2>
         {content} <br />
       </div>
   

Stylesheet for divs:

Code: Select all

div#content {
   margin: 1.5em auto 2em 0;   /* some air above and under menu and content */
}


div#main {
   margin-left: 29%; /* this will give room for sidebar to be on the left side, make sure this space is bigger than sidebar width */
   margin-right: 2%; /* and some air on the right */
}

div#sidebar {
   float: left;        /* set sidebar on the left side. Change to right to float it right instead. */
   width: 26%;     /* sidebar width, if you change this please also change #main margins */
   display: inline;  /* FIX IE double margin bug */
   margin-left: 0;
}
Thank you,

TJ
Last edited by TJINAK on Tue Oct 16, 2007 7:42 pm, edited 1 time in total.
TJINAK
Forum Members
Forum Members
Posts: 136
Joined: Wed Feb 22, 2006 1:01 am

Re: why 100% table width doesnt take up 100% of content area?

Post by TJINAK »

Upon further review I find that there is no problem with the table width at 100% in Firefox.

So, I need help on how to resolve this for IE 7, since thats what the boss uses...

If only IE could be standards compliant...

Thank you very much for your help and consideration on this issue.

TJ
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: why 100% table width doesnt take up 100% of content area?

Post by RonnyK »

TJ,

what happens if you set it to 99%? IE might not like the full 100% as it calculates differently.....

Ronny
TJINAK
Forum Members
Forum Members
Posts: 136
Joined: Wed Feb 22, 2006 1:01 am

Re: why 100% table width doesnt take up 100% of content area?

Post by TJINAK »

Thanks Ronny but no joy.

It has to do with the sidebar and the content css.  I've created a second content are to sit below the sidebar and main content area then copied and pasted the same code for the table into the second content area and the table takes up 100% of the width.
Attachments
100%TABLE_WIDTH.gif
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: why 100% table width doesnt take up 100% of content area?

Post by Dr.CSS »

A link would help a lot...

You need to go thru all the CSS attached to the template, if it is a default template w/ default CSS one has a call for #main table or td...
TJINAK
Forum Members
Forum Members
Posts: 136
Joined: Wed Feb 22, 2006 1:01 am

Re: why 100% table width doesnt take up 100% of content area?

Post by TJINAK »

Got it!!!

Did a little math and added the proper width:

div#main {
  margin-left: 27%; /* this will give room for sidebar to be on the left side, make sure this space is */
  margin-right: 1%; /* and some air on the right */
  width: 72%;}

That did the trick.

TJ
Post Reply

Return to “Layout and Design (CSS & HTML)”