473,804 Members | 2,280 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Combining 100% width tables with float

Okay, this is driving me nuts, and while I'm still researching, I'm
hoping someone here can help.

I'm trying to create a simple page with a navigation menu on the left
side of the main content area. On the right side, I have a content
div that contains an h1 title and a table that I'd like to take up the
full width of the div (but not, of course, run over the navigation
menu).

So I try something like this in my CSS:

#navbar {
float: left;
width: 10em;
}

#content {
margin-left: 11em;
}

And in my HTML, I'll have something like this:

<div id="navbar">Thi s is a test...</div>
<div id="content">
<h1>Test Page</h1>
<table style="width: 100%;">
<tr><th>Colum n 1</th><th>Column 2</th></tr>
<tr><td>Datum 1</td><td>Datum 2</td></tr>
</table>
</div>

In Firefox, this works great. The table takes up the full width of
the content div and appears immediately under the heading, which is
what I want.

However, in Internet Explorer 6, the heading works, and the top of the
title is aligned with the top of the navbar. If I put text in p tags
under the heading, it all lines up nicely. But the table is acting
like it has a clear:left; style specification, which it doesn't. I've
even tried explicitly setting clear:none; to no avail. It's being
rendered so that the top of the table aligns a pixel under the bottom
of the navbar.

I know that IE has lots of little CSS bugs that drive people nuts, but
I can't find what's causing this particular one or how to fix it. I'd
love to change our corporate standard to Firefox, but unfortunately,
that's just not an option.

Anyone have any clues what's going on here and how to coax IE 6 into
rendering the table immediately under the title like it's supposed
to? I'm forcing strict mode (not quirks mode) by using the following
doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Any help is appreciated!

Mar 12 '07 #1
2 2896
I've posted an HTML page with css styles in it to show the problem I'm
having. It's here:

http://skippus.com/iecss/iecss.html

Again, any help that anyone can give would be greatly appreciated.

Mar 13 '07 #2
TonyV wrote:
I've posted an HTML page with css styles in it to show the problem I'm
having. It's here:

http://skippus.com/iecss/iecss.html

Again, any help that anyone can give would be greatly appreciated.
table {
border: 1px solid blue; width: 99%;

<!-- I want the table to fill the containing div --DELETE line

/* but IE has 100% problems, oversets and clears it down,
so the answer is to use 99% or 99.5%

Use the HTML "comments" only in HTML and
use CSS "comments", as here, in CSS */
}

--
Gus
Mar 13 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
23010
by: patrick h. | last post by:
Greetings, I am encountering some issues regarding using float while desiring to set the height to 100%. This is likely due to my own misunderstanding of the way things actually function -- any guidance would be appreciated. To summarize, I would like to have a variable-width, 100% height, left-floating column. However, it seems as though with Mozilla/Netscape that height: 100% is not interpreted as I would
0
1493
by: Paul E Collins | last post by:
Hello. Suppose I use the following code to split a Web page into four separately scrollable quarters, each having 50% page width and 50% page height. Is it then possible to add *fixed*-height header and footer divs without possibly tipping the total page height over 100%? How would this be coded? (I ask mainly out of academic interest. No doubt this layout has usability issues.)
17
2146
by: Mike | last post by:
I'm trying to create a page: Three sections (left, topright and bottomright), each with a heading and scrolling (overflow) content. The size of these sections should be based upon the size of the user's viewable area in their browser. I'm close... really close, but I'm confused over how to mix specific measurements with percentages. When I began, things were quite nice: (http://play.psmonopoly.com/autosize.html). A little clunky in...
11
5416
by: yawnmoth | last post by:
How do you get both of these div's to have a 100% width? (1): <div style="float: left; background: black; color: white">Hello, world! </div> <div style="clear: both; background: blue; color: white">Hello, world! </div> You could set the width inside the floated div to 100% but if you do that and if you have a floated fixed width div, the 100% width div will appear on a new line, as demonstrated (2):
0
1917
by: sannymak | last post by:
Hello All, I have some problems making the columns 100% and forcing the footer at the bottom. Please refer to the code below and let me know a solution: HTML CODE: <!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"><!-- InstanceBegin template="/Templates/templatetest.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta...
0
1408
by: microgolf | last post by:
Hey, i'm new to this group beceaus i have a question i have been trying to solve for a few days now but i just cant figure it out. I am trying to constrain the min-width of my site, but i have some div's in there with a fixed and absolute positioning... And these two dont seem to get along? Or maybe it is beceaus i use z-index to layer some divs.
1
1023
by: slinky | last post by:
Thanks for any help folks: I have two .aspx pages that are workling well: one is for entering entries in a blog and another for viewing those entries. What I want to do is combine the two into one so I have a textbox and submit button at the top and the blog entries below. Any ideas? Here is my entry page:
4
4336
by: Christopera | last post by:
Hello, I have built a site that uses two divs, one verticle, and one horizontal as graphic style for the ite. The problem I am having is that if the browser is resized very small the divs are then smaller than the website is wide. I have tried fixed positioning but then i get the dreaded overlap when the browser is smaller than the website. Absolute positioning gets rid of the overlap but then brings on the width issue. Is there a way to...
1
1582
by: adamjblakey | last post by:
Hi, Right i have just built a site which has 3 divs align to the left and in the outer 2 divs i have a background which i want to be a 100% so when the middle stretches so do the outer 2 but it does not happen. Please can you have a look at my code: 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>...
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10599
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10346
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10347
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9173
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7635
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5531
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3832
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.