473,854 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Margins ignored by table - how can I fix?

Hi,

Consider the following:

#Content {
margin:0px 210px 50px 200px;
padding:10px;
}

If I use it with the following HTML:

<div id="Content">
<p>The quick brown fox jumps over the lazy dog. The quick brown fox
jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps
over the lazy dog. The quick brown fox jumps over the lazy dog. The
quick brown fox jumps over the lazy dog. The quick brown fox jumps
over the lazy dog. </p>
<table style="width: 100%;">
<tr><td bgcolor="#ffaaa a">head</td><td
bgcolor="#aaffa a">head2</td></tr>
<tr><td>content </td><td>stuff</td></tr>
<tr><td>bits</td><td>things</td></tr>
</table>
</div>

then under IE 5.5 the table does not sit within the margins, but
crashes out into the area to the right.

However in Firebird, Mozilla and Safari, it sits in the middle coloum
and obeys the margins.

Ignoring the fact that the rendering of IE 5.5 is not as good as the
others - is there any way I can fudge it so that the table works on
version 5.x of IE?

Many thanks,

Richard
Jul 20 '05 #1
7 3286
Richard Lawrence wrote:
[snip]

then under IE 5.5 the table does not sit within the margins, but
crashes out into the area to the right.
Probably a bug.
However in Firebird, Mozilla and Safari, it sits in the middle coloum
and obeys the margins.
Probably correct.
Ignoring the fact that the rendering of IE 5.5 is not as good as the
others - is there any way I can fudge it so that the table works on
version 5.x of IE?


It looks like you are using <table> for a presentational thing, aren't
you? In that case you should replace it with real HTML elements, like
<h1>, <h2> etc.

--
Anne van Kesteren
<http://www.annevankest eren.nl/>
Jul 20 '05 #2
Anne van Kesteren <ma**@annevanke steren.nl> wrote in message news:<bt******* ***@reader08.wx s.nl>...
Ignoring the fact that the rendering of IE 5.5 is not as good as the
others - is there any way I can fudge it so that the table works on
version 5.x of IE?


It looks like you are using <table> for a presentational thing, aren't
you? In that case you should replace it with real HTML elements, like
<h1>, <h2> etc.


Hi,

Thanks for your response. However I am confused. How can I replace it
with real HTML elements?

If I want to create a table within the middle area (defined by my
stylesheet) that compaires say one product to another (with a list of
the feature, two coloums and a number of ticks and crosses) how else
can I do this without resorting to a table?

Regards,

Richard.
Jul 20 '05 #3
Richard Lawrence wrote:
Anne van Kesteren <ma**@annevanke steren.nl> wrote in message
news:<bt******* ***@reader08.wx s.nl>...
It looks like you are using <table> for a presentational thing,
aren't you? In that case you should replace it with real HTML
elements, like <h1>, <h2> etc.


If I want to create a table within the middle area (defined by my
stylesheet) that compaires say one product to another (with a list
of the feature, two coloums and a number of ticks and crosses) how
else can I do this without resorting to a table?


It sounds like you cannot. If it's tabular data, then (of course) use
table markup.

uri?

--
Brian
follow the directions in my address to email me

Jul 20 '05 #4
Brian <us*****@juliet remblay.com.inv alid-remove-this-part> wrote in message news:<WEdLb.779 774$Tr4.2233563 @attbi_s03>...
Richard Lawrence wrote:
Anne van Kesteren <ma**@annevanke steren.nl> wrote in message
news:<bt******* ***@reader08.wx s.nl>...
It looks like you are using <table> for a presentational thing,
aren't you? In that case you should replace it with real HTML
elements, like <h1>, <h2> etc.


If I want to create a table within the middle area (defined by my
stylesheet) that compaires say one product to another (with a list
of the feature, two coloums and a number of ticks and crosses) how
else can I do this without resorting to a table?


It sounds like you cannot. If it's tabular data, then (of course) use
table markup.

uri?


Hi,

Yes it will be tabular data. Here is a mockup of how the site will
look:

http://www.mercury.uk.net/mockup/index.html

As you can see, the test table looks fine on modern browsers, but IE
5.5 does not adhere to the margins defined. I'm happy to use some
horrible hack to get it working as long as those users can see it -
but even then, i'm not sure what the hack could be.

Many thanks for any advice!

Regards,

Richard.
Jul 20 '05 #5
Richard Lawrence wrote:

Yes it will be tabular data. Here is a mockup of how the site will
look:

http://www.mercury.uk.net/mockup/index.html
Without real content, it's hard to know whether the markup makes
sense. It doesn't really look like tabular data to me, but I can't say
for sure.
As you can see, the test table looks fine on modern browsers, but
IE 5.5 does not adhere to the margins defined.
What margins are you defining?
I'm happy to use some horrible hack to get it working as long as
those users can see it - but even then, i'm not sure what the hack
could be.
Before applying a hack, figure out what is causing the scrollbars.
Have you set a width to the table?
Many thanks for any advice!


My advice is that you have more serious problems then margins on the
table in one particular browser.

1. You have invalid markup in your table where you set a bgcolor for
td. Rather than fix it, just remove it altogether, and use css to
suggest the colors you want.

2. Why have you specified a font-size less than 100%? I have already
chosen a size that I find comfortable, thank you, and I don't need
authors telling me that they know better.

body {font-size: 100%;}

It's arguably acceptable to use a smaller font-size in a *limited*
fashion, e.g., for a copyright notice.

div.copyright {font-size: 90%;}

--
Brian
follow the directions in my address to email me

Jul 20 '05 #6
Brian <us*****@juliet remblay.com.inv alid-remove-this-part> wrote in message news:<ikBMb.332 36$5V2.50235@at tbi_s53>...
Richard Lawrence wrote:

Yes it will be tabular data. Here is a mockup of how the site will
look:

http://www.mercury.uk.net/mockup/index.html
Without real content, it's hard to know whether the markup makes
sense. It doesn't really look like tabular data to me, but I can't say
for sure.


Scroll to the bottom of the page. There is a table there which I'm
trying to get to fit into the middle coloum.
As you can see, the test table looks fine on modern browsers, but
IE 5.5 does not adhere to the margins defined.


What margins are you defining?


From layout.css:

#Content {
margin:0px 210px 50px 200px;
padding:10px;
}
I'm happy to use some horrible hack to get it working as long as
those users can see it - but even then, i'm not sure what the hack
could be.


Before applying a hack, figure out what is causing the scrollbars.
Have you set a width to the table?


Yes, in index.html:

<table style="width: 100%;">

I want the table to span the entire coloum and not occupy the smallest
amount of space. <table> works, but it's crushed up to the smallest
possible space, which isn't what I want. I can't set pixel widths
because they'll be wrong when someone resizes and

<table id="Content">

doesn't fix the problem either.
My advice is that you have more serious problems then margins on the
table in one particular browser.


Thanks for these. Although everything else apart from the table is
valid XHTML 1.0 Strict, I wasn't intending on using the table in its
current form for anything else but testing the margins problem. The
background colours are just to hilight to me (and others) where the
cell problems are. Having said all that, I've corrected the problems
(including font percentages), but unfortunately i'm still no closer to
forcing the table to adhere to the margin specified by the stylesheet.

If you don't have IE 5.5 to hand, then you can see the problem in a
screenshot at http://www.fourteenminutes.com/screen.gif

Any suggestions gratefully received.

Many thanks,

Richard.
Jul 20 '05 #7
Richard Lawrence wrote:
Brian wrote
http://www.mercury.uk.net/mockup/index.html
Without real content, it's hard to know whether the markup makes
sense.


Scroll to the bottom of the page. There is a table there which I'm
trying to get to fit into the middle coloum.


I found the table just fine. But there's no real tabular data in it.
So I cannot comment on whether a table is correct markup. No matter.
#Content { margin:0px 210px 50px 200px; padding:10px; }
Have you set a width to the table?
Yes, in index.html:

<table style="width: 100%;">


That looks like the problem. You want the table width to be 100% of
the available space, *and* you want margins tacked on. If for example
the available space is 400px, the table width will be 400px. Add
padding of 10px on left and right; add margin of 210px and 200px, and
the total width is 830px, much larger than the available 400px. Hence
horizontal scrollbars.
I want the table to span the entire coloum and not occupy the
smallest amount of space.
Lose the margins. Keep the width.
<table> works, but it's crushed up to the smallest possible space,
which isn't what I want.
Again, your wishes make me wonder whether it really is tabular data.
unfortunately i'm still no closer to forcing the table to adhere to
the margin specified by the stylesheet.


You cannot really force anything on the www. Not even with layout
tables and fixed positioning.

http://webtips.dan.info/force.html

--
Brian
follow the directions in my address to email me

Jul 20 '05 #8

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

Similar topics

4
2464
by: Michael Liu | last post by:
I have these styles: p, pre, table { margin: 1em; } And this HTML: <p>A paragraph</p> <table><tr><td>A table</td></tr></table> <pre>A preformatted block</pre> <p>A paragraph</p>
8
4421
by: Jukka K. Korpela | last post by:
I just noticed that most browsers render <table border="1"><tr><td><p>foo</p></td></tr></table> the same way as <table border="1"><tr><td>foo</td></tr></table> That is, they ignore the p markup in the sense that they don't apply the normal default top and bottom margins. This is rather odd, especially
8
9658
by: Tinus | last post by:
Hello all, Because you have been so helpfull the last couple of times, I thought after testing and wasting more than 20 pages (and google-ling for 3 days :-( ). I would ask you again for your help. The problem is this: If I print a rectangle which begins at (0,0) and the margins are also set to 0 (l:0, t:0, r:0, b:0) then it prints fine (ok, not quite because 0,0 is inside the none printable area but I corrected for that by checking...
7
2757
by: tm | last post by:
I am trying to print a form using the following code, everything works fine but the margins are not acted upon. What I am I doing wrong? Private Sub CaptureScreen() Dim myGraphics As Graphics = Me.CreateGraphics() Dim s As Size = Me.Size memoryImage = New Bitmap(s.Width, s.Height, myGraphics) Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
0
1432
by: Todd | last post by:
Hi guys, Strange bug if someone could help. ... Im using printDialog, printDocument and printPreviewDialog to write my print routines for a graphics application. I want to allow the user to specify the margins so Im setting (Im setting both as I dont know which one I should set!) :- margins = new Margins(left, right, top, bottom);
5
11154
by: Anne DeBlois | last post by:
Hi, We are developing a database application in Visual Basic.NET 2005. The application will print label pages. Using the PrintDocument and GDI+ classes, I noticed a slight change when printing to a laser printer and when printing to an inkjet printer. It's got to be the margins (defined by the printer driver). Is it possible to programmatically override the driver's margins in VB (at our risks)? If so, how to? Thanks in advance,
7
20746
by: Mark | last post by:
Hi, I am creating application in VB 2005. and when I print report it adds extra 0.45 cm margin on left and top, and the reason for this is physical margins of printer. Is it possible to change printer's physical margins using VB coding? Cheers -- Osmotion Blue
3
2934
by: Patient Guy | last post by:
For a long time, this page has been up and an embarrassment. http://tinyurl.com/ylcqum In Firefox, the table moves out of its parent container with the negative margin, but not in MSIE6. Does someone keep a list of workarounds in dealing with problems like these for the browsers that when listed in ranking order with respect to use, make up the 95-99% cumulatively used browsers?
11
2232
by: listerofsmeg01 | last post by:
Argh! I'm going nuts trying to get a constant margin after a floated div that works cross browser. This works in IE but not Firefox: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head></head> <body> <div style="float:left; height:100px; background-color:red;">Hi, I'm floating</div>
0
9901
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9750
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
11024
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
10364
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9510
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
7909
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
5738
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...
0
5937
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4150
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.