By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,676 Members | 1,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,676 IT Pros & Developers. It's quick & easy.

Let the margin left of a table be exactly 80 pixels ???

P: n/a
I would like to place a table <TABLE>...</TABLE> in such a way on a web page that
the margin left of it is exactly 80 pixels. Furthermore the width of the table should be
90% of the rest of the browser window (=the right part except the 80 pixels).

How do I specify these properties in a HTML code?

Ted

Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
in post: <news:c9*************@news.t-online.com>
Ted Mencini <te*******@hotmail.com> said:
I would like to place a table <TABLE>...</TABLE> in such a way on a
web page that the margin left of it is exactly 80 pixels. Furthermore
the width of the table should be 90% of the rest of the browser
window


div{margin-left:80px;margin-right:10%;}
table{width:100%;}

<div><table><tr><td>a table thingy</td></tr></table></div>
--
b r u c i e
Jul 20 '05 #2

P: n/a
On Wed, 26 May 2004 14:49:25 +0200, Ted Mencini <te*******@hotmail.com>
wrote:
I would like to place a table <TABLE>...</TABLE> in such a way on a web
page that the margin left of it is exactly 80 pixels. Furthermore the
width of the table should be 90% of the rest of the browser window (=the
right part except the 80 pixels). How do I specify these properties in a HTML code?


You don't. With CSS, you can come close. You can use something like this:
table {width: 90%; margin-left: 80px;}
.... were the width of the table is of course a little bigger than what you
asked. CSS doesn't have a rule to say '90 percent of what is left after
using a 80 pixel margin'.

Another option is to set a left-padding of 80px on the containing element,
presumably BODY, like this:

body {margin: 0; padding-left: 80px;}
table {width: 90%;}

.... which will work fine if you don't write complex pages with nested and
positioned DIVs and tables etc.

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen
Jul 20 '05 #3

P: n/a
On Wed, 26 May 2004 23:03:27 +1000, brucie <sh**@bruciesusenetshit.info>
wrote:
in post: <news:c9*************@news.t-online.com>
Ted Mencini <te*******@hotmail.com> said:
I would like to place a table <TABLE>...</TABLE> in such a way on a
web page that the margin left of it is exactly 80 pixels. Furthermore
the width of the table should be 90% of the rest of the browser
window


div{margin-left:80px;margin-right:10%;}
table{width:100%;}

<div><table><tr><td>a table thingy</td></tr></table></div>


To more precisely match OP's needs, I'd do:

div {margin-left:80px; margin-right:0;position: relative;}
table {width: 90%;}
Jul 20 '05 #4

P: n/a
Ted Mencini wrote:
I would like to place a table <TABLE>...</TABLE> in such a way on a web page that
the margin left of it is exactly 80 pixels. Furthermore the width of the table should be
90% of the rest of the browser window (=the right part except the 80 pixels).

How do I specify these properties in a HTML code?


div {
margin-left: 80px
}
table {
width: 90%
}

<div>
<table>
...
</table>
</div>

<http://www.fit.fraunhofer.de/~koch/ted_mencini.html>
Works at least with recent Mozilla, Opera, WinIE
--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.