css- 2 boxes, one=200px, second=(100%-200px)- how?

G

Guest

Hello,
How can I manage to make 2 boxes in CSS-

one with width=200px and second's width=(100%-200px). Such thing can be
easily done using frames and tables, so it must be possible using CSS too!
Why do I need it? Because I have a page with menu on the left (it's the
first box) and a box with text on the right (it should have width=100%-200px
to look good).

Regards,
Talthen
 
N

Neredbojias

With neither quill nor qualm, (e-mail address removed) quothed:
Hello,
How can I manage to make 2 boxes in CSS-

one with width=200px and second's width=(100%-200px). Such thing can be
easily done using frames and tables, so it must be possible using CSS too!
Why do I need it? Because I have a page with menu on the left (it's the
first box) and a box with text on the right (it should have width=100%-200px
to look good).

Have an outer div with padding-left:200px; and absolutely-position the
200 px inner div margin-left:-200px; inside it.
 
S

Steve Pugh

How can I manage to make 2 boxes in CSS-
one with width=200px and second's width=(100%-200px). Such thing can be
easily done using frames and tables, so it must be possible using CSS too!
Why do I need it? Because I have a page with menu on the left (it's the
first box) and a box with text on the right (it should have width=100%-200px
to look good).

Amongst other methods:

..box1 { float: left; width: 200px;}
..box2 { margin-left: 200px;}

Steve
 
G

Guest

Neredbojias said:
Have an outer div with padding-left:200px; and absolutely-position the
200 px inner div margin-left:-200px; inside it.

Well... it still doesn't work as desired:

=====
<html>
<head>
<style>
div.menu {position: absolute; margin-left: -170px; top: 0px; width: 130px;
font-size: 13px;
text-align: left; height: 100%;}
div.text {top: 0px; left: 0px; padding-left: 170px; height: 100%;
background-color: red; width: 100%;
float: left;}
</style>
</head>
<body>
<div class="text">
slowo
<div class="menu">
menu
</div>
</div>
</body>
</html>
===

I have validated it with http://jigsaw.w3.org/css-validator/ and it shows
that my code is correct.
However only MSIE and Opera shows it correctly, and Mozillas suck ;/
A tried many combinations of paddings and margins and I am a bit bored.
How can I make it work in Mozillas?

Regards,
Talthen
 
G

Guest

I dit smth with margin: Xpx Ypx Zpx Vpx; width: auto and now it works.
Thanks to google.
The problem with the previous soslution was, that (margins and paddings and
borders)'s width is added to the width of the element. So, when I do:
width: 100%; margin-left: 100px; then I have 100%+100pixels of total width.

Regards,
Talthen
 
N

Neredbojias

With neither quill nor qualm, (e-mail address removed) quothed:
I dit smth with margin: Xpx Ypx Zpx Vpx; width: auto and now it works.
Thanks to google.
The problem with the previous soslution was, that (margins and paddings and
borders)'s width is added to the width of the element. So, when I do:
width: 100%; margin-left: 100px; then I have 100%+100pixels of total width.

That is correct according to the standard. I generally don't set
percentage widths when using padding or margins in such a fashion unless
the latter are on an inner div.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top