Thank you Gunlaug and Tony, now it works.

On 9/13/06, Tony Crockford <[EMAIL PROTECTED]> wrote:
> Bernat Lleonart wrote:
> > Hello,
> >
> > I'm stuck with what seems a simple problem, but I can't find the
> > solution. I have a container and two div's inside it, one is floated
> > left (and it has a left margin), and the other is floated right (and
> > it has a right margin).
> >
> > While FF renders everything correctly, IE doen't respect the margins.
> >
> > Here's the 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"; xml:lang="es">
> >       <head>
> >               <meta http-equiv="content-type" content="text/html; 
> > charset=utf-8" />
> >               <title>...</title>
> >               <style type="text/css">
> >                       * {
> >                               margin: 0;
> >                               padding: 0;
> >                       }
> >                       body {
> >                               font-size: 100%;
> >                               text-align: center;
> >                               font-family: verdana, arial, sans-serif;
> >                               background: #42b587;
> >                       }
> >                       .clearit {
> >                               clear: both;
> >                       }
> >                       #contenidor {
> >                               width: 766px;
> >                               margin: 0 auto;
> >                               text-align: left;
> >                               background: #fff;
> >                       }
> >                       #principal {
> >                               width: 581px;
> >                               float: left;
> >                               background: aqua;
> >                               margin-left: 7px;
> >                       }
> >                       #secundari {
> >                               width: 150px;
> >                               float: right;
> >                               background: yellow;
> >                               margin-right: 16px;
> >                       }
> >               </style>
> >       </head>
> >       <body>
> >                       <div id="contenidor">
> >                               <div id="principal">
> >                                       <p>principal</p>
> >                               </div>
> >                               <div id="secundari">
> >                                       <p>secundari</p>
> >                               </div>
> >                               <div class="clearit">
> >                               </div>
> >                       </div>
> >       </body>
> > </html>
> > *********************
> >
> > Thanks for helping.
>
>
> try:
>
>                         #principal {
>                                 width: 581px;
>                                 float: left;
>                                 background: aqua;
>                                 margin-left: 7px;
>                                  display: inline;
>                         }
>                         #secundari {
>                                 width: 150px;
>                                 float: right;
>                                 background: yellow;
>                                 margin-right: 16px;
>                                  display: inline;
>                         }
>
>
> floated elements with a defined width trigger a doubled margin bug in
> IE, making them too wide for your container no doubt.
>
> see:
> http://www.positioniseverything.net/explorer/doubled-margin.html
> IE Doubled Float-Margin Bug - CSS fixes and workarounds
>
>
>
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to