Ok I had this in another post and thought I had resolved the issue so I marked as solved. I hove not resolved the issue after all, so I created a new thread, since the other one seemed to be dead.

I have a table that looks great on most resolutions except for the lowest resolution, 800x600 I think. When I view the page in this resolution, the table expands out beyond the div container it's set within. I think I have all the widths set to percentages, but somethings not right. Here is my CSS code:

body {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: small;
	margin: 0px;
	padding: 0px;
	background-color: #999;
}

#wrapper {
	padding: 0px;
	width: 75%;
	border: thin solid #ccc;
	margin-top: 5px;
	margin-right: auto;
	margin-bottom: 5px;
	margin-left: auto;
	background-color: #FFF;
}
#wrapper #main #sidebar p {
	font-size: xx-small;
}

#main {
	margin: 0px;
	padding: 0px;
	clear: both;
	width: 100%;
}
#content {
	width: 75%;
	border-left-width: thin;
	border-left-style: solid;
	border-left-color: #ccc;
	margin: 0 0 0 148px;
	padding: 0 20 0 10px;
}
#content table {
	margin: 0px;
	padding: 0px;
	width: 95%;
}

Here is the page code:

<body>
<div id="wrapper">
  <!--- Header Include --->
  <cfinclude template="header.cfm">
  <div id="main">
    <div id="sidebar">
      <!--- Sidebar Include --->
      <cfinclude template="sidebar.cfm">
    </div>
    <div id="content">
      <!--- Display Results of Search --->
      <p>Your Search Found <cfoutput>#rsSearch.RecordCount#</cfoutput> Bulbs</p>
      <p>Click on Item Number<br />
          to view Product Details.</p>
      <p>Refine your search
        by typing your brand name.</p>
      <form action="refined.cfm" method="post">
        <table>
          <td><input type="text" name="brandName" size="10" />
              <input type="submit" name="brandSubmit" id="brandSubmit" maxlength="25" value="Go" /></td>
        </table>
      </form>
      <cfif rsSearch.RecordCount GT 0>
        <div style="overflow:auto; height:500px; width: 95%;">
          <table border="1" cellpadding="1" cellspacing="0">
            <tr>
              <th>Item #</th>
              <th>Brand</th>
              <th>Base</th>
              <th>Glass</th>
              <th>Wattage</th>
              <th>Voltage</th>
            </tr>
            <cfoutput query="rsSearch">
              <tr>
                <td><a href="#rsSearch.oldPage#">#item#</a></td>
                <td>#rsSearch.brandName#</td>
                <td>#base#</td>
                <td>#glass#</td>
                <td>#wattage#</td>
                <td>#voltage#</td>
              </tr>
            </cfoutput>
            <tr align="center">
              <td colspan="7"><a href="search.cfm">Search Again</a>||<a href="results.cfm">Return to Top</a></td>
            </tr>
          </table>
        </div>
      </cfif>
      <cfif rsSearch.RecordCount EQ 0>
        <p>Please check Spelling or try another search criteria.</p>
      </cfif>
    </div>
  </div>
  <!--- Footer Include --->
  <cfinclude template="footer.cfm">
  </div>
</body>

Another thing is not only do tables expand, but some of my pages with just text expands as well, but I think if someone can point me in the right direction on this, I can figure out the rest. Thanks for any help in advance!

Recommended Answers

All 12 Replies

I had something like that happen and turned out that it was due to extraneous code which was confusing the browser. I inadvertently had nested body tags! It worked most of the time too.

I only way I found it was by looking at the rendered page source.

Yes I looked at the rendered source and didn't really see anything wrong. I'm still rather new at html and css, so maybe I'm missing something. You didn't see anything worng with my css that would cause this issue? Thanks for your help!

Hi teedoff,

I took a look at your code and I think I found the problem. After resizing to a very small browser, I saw the table "sticking out" past the white content area and going into the gray background area. Analyzing the code, I saw that you are using fixed margin sizes rather than percentages. You'll have to use percentages for margins (specifically #content).

Hope that helped,
floatingDivs

awesome! thanks floatingDivs that works, but now I am having trouble keeping my sidebar tabs from expanding..lol I have them set to percentages, but cant seem to get it exactly the way it needs to be! Any suggestions?

#sidebar {
	float: left;
	width: 18%;
	padding: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	margin-left: 2px;
}
#sidebar ul {
	padding: 0;
	width: 90%;
	list-style-type: none;
	background-color: #CCC;
	margin: 0;
}
#sidebar li {
	margin: 0;
	padding: 0;
	list-style-type: none;
	font-size: 95%;
}
#sidebar li a {
	margin: 0px;
	padding: 0.5em 0 0.5em 2em;
	border-width: 1px;
	border-color: #ffe #aaab9c #ccc #fff;
	border-style: solid;
	color: #777;
	display:block;
	width: 82%;
	text-decoration:none;
}
#sidebar li a:link, #sidebar li a:visited  {
	color: #777;
}

#sidebar li a:hover, #sidebar li a:active  {
	color: #09F;
	background: transparent;
	border-color: #aaab9c #fff #fff #ccc;
}

I am using a cfinclude for my sidebar so here is the simple html for sidebar.

<ul>
  <li><a href="index.cfm">Home</a></li>
  <li><a href="faqs.cfm">FAQS</a></li>
  <li><a href="http://www.replacementlightbulbs.com/lampscrossreference.html">Cross References</a></li>
  <li><a href="shipping.cfm">Shipping</a></li>
  <li><a href="http://www.replacementlightbulbs.com/policy.html">Policies</a></li>
  <li><a href="terms.cfm">Definitions</a></li>
  <li><a href="contactUs.cfm">Contact Us</a></li>
</ul><br />

<p><strong>Order Line:</strong><br />
1-800-692-3051</p>
<p><strong>Technical Support Line:</strong><br />
 1-336-882-2854</p>
<p><strong>Fax Line:</strong><br />
 1-336-882-2819</p>

What am I missing? The sidebar tabs expand now to the right over the left border of the #content div. Thanks again!

You can use % for margins and borders too. I would stick with whole numbers though.
There is no need to specify 0 if you are not using a margin property, so you can delete a bunch of those lines.

As far as the overlap is concerned, if you add all of the padding margins, widths and borders of content and sidebar are they <= 100% ?

You can use % for margins and borders too. I would stick with whole numbers though.
There is no need to specify 0 if you are not using a margin property, so you can delete a bunch of those lines.

As far as the overlap is concerned, if you add all of the padding margins, widths and borders of content and sidebar are they <= 100% ?

Hi JRM, well for me this kind of stuff is the hardest to grasp. Keeping divs that are side by side the right width so that they, together, add up to 100% of the width of the page wrapper. Everything looks great on wider resolutions, but on the smaller ones is where the sidebar tabs expand to the right. Also, the background width of the tabs dont expand in unison with the foreground. Trying to figure this out, but I am drawing a blank! lol

You might want to google div box model to get a feel about what is referenced to what with margins borders and paddings.
I have found that mixing px and % can cause problems since one is an absolute and the other is not.

I have also found it useful at times to "lock" the magins of a feature to the left or right with position-absolute margins in px , so that they stay relative to the outer page wrapper where they need to be. All the stuff in between is in % unless there is a real compelling reason to do otherwise. Then it works like an accordion "breathing" in and out as it gets resized without overlap if everything is set up right.

Hey, I'm no guru, but when I mess with it enough, I get it done!
Every template is different, so there are no hard and fast rules, just generalities!

Thanks for the info JRM. I do know some about a box model. Looking at my code and css though, I dont see anything but percentages. I think the issue is with the tabs and their rollover effects and such. When I go to a lower resolution, the background, or foreground, not sure which, is what's messing up. I have played with the styles for each over and over again and it just wont do what I want it too. The 0 margins are there because when I first started out, it got into the habit of setting every page element's margins and padding to 0's. That way I have a starting point with an element, and I also know that with 0's, there is never a question of why something isnt lining up at first. I usually go back and delete those empty rules when I'm finished...lol

Ok still having trouble with my sideBar tabs. My laptop screen res is 1440 x 900, one of my desktop screens is 1920 x 1080 and the other is 1680 x 1050. All three show the tabs differently. I know it's something simple, but I cant get it figured out. Please will someone load my html and css on their machine and see how they appear in different resolutions. I really need to get this right.

html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Replacement Light Bulbs : Home</title>
<link href="rlb.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="wrapper">
  <cfinclude template="header.cfm">
  <div id="main">
    <div id="sidebar">
      <cfinclude template="sidebar.cfm">
    </div>
    <div id="content">
      <h2>Find Your Replacement Bulb</h2>
      <p>We are a commercial and residential resource for   light bulbs from quality manufacturers including Philips Lighting, Osram, Eiko,   Halco, Thorn, Sylvania, Hakari, Higuchi, Kandolite and General Electric. We   stock replacement lighting and lamps including incandescent bulbs, halogen light   bulbs, PAR halogen and incandescent lamps, MR8 lamps, MR11 lamps, MR13 lamps,   MR14 lamps, MR16 lamps, compact fluorescent bulbs, metal halide bulbs, high   intensity discharge bulbs (H.I.D.), full spectrum light bulbs, ANSI code bulbs,   projector bulbs, projection bulbs, medical bulbs, dental bulbs, surgical bulbs,   automotive bulbs, auto bulbs. We offer a lighting cross reference for GE light   bulbs, GE bulbs, Osram/Sylvania light bulbs, Osram/Sylvania bulbs, Philips light   bulbs and Philips bulbs. We carry exit sign replacement bulbs, and emergency   lighting replacement lamps.</p>
      <p>Our bulbs and replacement lights are divided into catagories. Select a catagory or use the Advanced Search Feature below.</p>
      <p align="center"><a href="photoLighting.cfm">Photo &amp; AV Lamps</a> &bull; <a href="studioLighting.cfm">Stage Studio/Theatre</a> &bull; <a href="generalLighting.cfm">General Lighting</a><br />
        <a href="sealedLighting.cfm">Sealed Beams</a> &bull; <a href="##">Dental Lamps</a> &bull; <a href="medicalLighting.cfm">Medical Lamps</a> &bull; <a href="fluorescentLighting.cfm">Fluorescent Lamps</a><br />
        <a href="##">LCD and TV Lamps</a> &bull; <a href="##">Bargain Priced Lamps</a> &bull; <a href="##">Hard To Find Lamps</a><br />
        <a href="##">Lamp Sockets</a> &bull; <a href="##">Batteries</a></p>
      <form action="search.cfm" method="post" name="search">
        <p align="center"><strong>Advanced Search</strong>
          <input name="Search" type="submit" value="Search" />
      </form>
      </p>
    </div>
  </div>
  <cfinclude template="footer.cfm">
</div>
</body>
</html>

CSS

@charset "utf-8";
html { 
    overflow-y: scroll
}

body {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: small;
	margin: 0px;
	padding: 0px;
	background-color: #999;
}

#wrapper {
	padding: 0px;
	width: 80%;
	border: thin solid #ccc;
	margin-top: 5px;
	margin-right: auto;
	margin-bottom: 5px;
	margin-left: auto;
	background-color: #FFF;
}
#wrapper #main #sidebar p {
	font-size: xx-small;
}

#main {
	margin: 0px;
	padding: 0px;
	clear: both;
	width: 100%;
}
#content {
	width: 80%;
	border-left-width: thin;
	border-left-style: solid;
	border-left-color: #ccc;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0;
	margin-left: 16%;
	padding-top: 0;
	padding-right: 1%;
	padding-bottom: 0;
	padding-left: 1%;
}
#content table {
	margin: 0px;
	padding: 0px;
	width: 95%;
}


hr {
	text-align: center;
	width: 80%;
	margin-left:auto;
	margin-right:auto;
}

th {
	background-color: #eaeaea;
}

#sidebar {
	float: left;
	width: 15%;
	padding: 0px;
	margin-top: 0px;
	margin-right: 1%;
	margin-bottom: 0px;
	margin-left: 1%;
}
#sidebar ul {
	padding: 0;
	width: 90%;
	list-style-type: none;
	background-color: #CCC;
	margin: 0;
}
#sidebar li {
	margin: 0;
	padding: 0;
	list-style-type: none;
	font-size: 95%;
}
#sidebar li a {
	margin: 0px;
	padding: 0.5em 0 0.5em 2em;
	border-width: 1px;
	border-color: #ffe #aaab9c #ccc #fff;
	border-style: solid;
	color: #777;
	display:block;
	width: 85%;
	text-decoration:none;
}
#sidebar li a:link, #sidebar li a:visited  {
	color: #777;
}

#sidebar li a:hover, #sidebar li a:active  {
	color: #09F;
	background: transparent;
	border-color: #aaab9c #fff #fff #ccc;
}
#footer {
	clear: both;
}
#wrapper #main p {
	margin-right: auto;
	margin-left: auto;
	width: 90%;
}

#footer p {
	text-align: center;
}
.yellowBG {
	background-color: #FFFF99;
	padding: 0px 5px;
}
a img {border: none;
}
#content table p {
	font-size: 9px;
}
#content div table tr th {
	font-size: 9px;
}
ul {
	list-style-type: none;
}

sidebar html

<ul>
  <li><a href="index.cfm">Home</a></li>
  <li><a href="faqs.cfm">FAQS</a></li>
  <li><a href="http://www.replacementlightbulbs.com/lampscrossreference.html">Cross References</a></li>
  <li><a href="shipping.cfm">Shipping</a></li>
  <li><a href="http://www.replacementlightbulbs.com/policy.html">Policies</a></li>
  <li><a href="terms.cfm">Definitions</a></li>
  <li><a href="contactUs.cfm">Contact Us</a></li>
</ul><br />

<p><strong>Order Line:</strong><br />
</p>
<p><strong>Technical Support Line:</strong><br />
 </p>
<p><strong>Fax Line:</strong><br />
 </p>

That should be all that's needed, if not let me know. Again, I have the sidebar styles all set to percentages. I want the tabs to show the same way on any resolution. TIA

If you are using firefox, you can load the firebug tool. It highlights areas controlled by selected code. If there is an error in some part it helps define the problem. There are a couple of other good tools for firefox as well.

JRM, installed firebug and went through, but didn't see anything that stuck out as an issue. Or maybe I don't know how to use firebug yet..lol Anyway, still not making any leadway to resolving this problem. Maybe someone could look at the site as it is now. www.michael-sexton.com/rlb/index.cfm

If you view it in different resolutions, you will see what I am talking about. The sidebar tabs are the issue. You will see the border of each <li> but there will be about 15 or so px that stick out on the right side of each <li>. When you roll over, the foreground is transparent, so then you will see the background demensions of the <li>, which is what is sticking out. The problems has got to be in the width properties of either the <ul>, <li>, or the <a>. No matter what percentage of width I set for any of those tags, nothing works completely.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.