Вопрос

Фон

Мне нужно сделать довольно сложный макет для клиента, используя фиксированный DIV. Все хорошо в IE8, FF3 и Chrome, но IE7 все исправляет

Изменить: Фиксированные DIVs являются обязательными, прокручивать должен только DIV контента (это спецификации, извините)

HTML и CSS-код

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>
    test
</title>

    <!--[if lt IE 8]>

    <![endif]--> 

    <!--[if lt IE 7]>

    <![endif]--> 

</head>

<body style="margin: 10px;">
<div id="wrapper" style="width: 960px; margin: 0 auto; position: relative;  border: 1px solid red; overflow: hidden;">

    <div id="header" style="position: fixed; width: 185px;  height: 600px;  top: 10px;  border: 1px solid blue;">
      header
    </div>

    <div id="content" style="width: 680px; float: left; background: white; margin-left: 185px;  min-height: 600px;  border: 1px solid lime;">
        content
    </div>

    <div id="rightcolumn" style="position: fixed; top: 10px; width: 90px; margin-left: 865px;   height: 600px;border: 1px solid maroon;">
        right
    </div>

</div> 


</body>
</html>

Ширина IE8, FF3 и Chrome

IE8, FF3 и Chrome http://img39.imageshack.us/img39/ 406 / firefoxkpd.jpg

Ширина IE7

IE7 http://img23.imageshack.us/img23/1315/ie7l. JPG

Примечания

Меня не очень беспокоит IE6, потому что я знаю, что он не поддерживает элементы Fixed, но если вы знаете, как это исправить, отлично!

Вопросы

<Ол>
  • Что я должен знать об ошибках IE7, чтобы исправить проблему?
  • Как я могу ссылаться на левые в столбцах заголовка относительно оболочки
  • Почему заголовок столбца идет вправо, а правый столбец исчезает?
  • Это было полезно?

    Решение

    Нашел исправление !! Достаточно странно, что содержимое right исправляет его!
    Я зарабатываю печенье?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>
        test
    </title>
    
        <!--[if lt IE 8]>
    
        <![endif]--> 
    
        <!--[if lt IE 7]>
    
        <![endif]--> 
    
    </head>
    
    <body style="margin: 10px;">
    <div id="wrapper" style="width: 960px; margin: 0 auto; position: relative;  border: 1px solid red; overflow: hidden;">
    
        <div id="header" style="position: fixed; width: 185px; height: 600px;   top: 10px; border: 1px solid blue;">
          header
        </div>
    
        <div id="content" style="float: right; width: 680px; margin-right: 90px; height: 600px; border: 1px solid lime;">
            content
        </div>    
    
        <div id="rightcolumn" style="position: fixed; top: 10px; width: 90px; margin-left: 865px;   height: 600px;border: 1px solid maroon;">
            right
        </div>
    
    
    </div> 
    
    
    </body>
    </html>
    

    Другие советы

    Как насчет этого?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>
        test
    </title>
    
        <!--[if lt IE 8]>
    
        <![endif]--> 
    
        <!--[if lt IE 7]>
    
        <![endif]--> 
    
    </head>
    
    <body style="margin: 10px;">
    <div id="wrapper" style="width: 960px; margin: 0 auto; position: relative;  border: 1px solid red; overflow: hidden;">
    
        <div id="header" style="float: left; width: 185px;  height: 600px;      top: 10px;      border: 1px solid blue;">
          header
        </div>
    
        <div id="content" style="width: 650px; float: left; background: white; left: 185px;  min-height: 600px; height: 600px;      border: 1px solid lime;">
            content
        </div>
    
        <div id="rightcolumn" style="float: left; top: 10px; width: 90px; left: 865px;   height: 600px;border: 1px solid maroon;">
            right
        </div>
    
    </div> 
    </body>
    </html>
    

    Он работает в IE7, Firefox, Opera, Safari и Chrome. Я думаю, это будет работать в IE6 и IE8 тоже. Мне пришлось уменьшить ширину & Quot; content & Quot; потому что (rightcolumn + content + header) < Обертка

    Фиксированная позиция не работает в старых браузерах. Вы можете плавать элементы рядом друг с другом.

    Укажите также нулевое заполнение для тела, Opera использует дополнение по умолчанию вместо margin (что на самом деле имеет больше смысла).

    Я поместил стили в таблицу стилей, чтобы сделать код чище:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>test</title>
    
    <style type="text/css">
    body { margin: 10px; padding: 0; }
    #wrapper { width: 960px; margin: 0 auto; border: 1px solid red; overflow: hidden; }
    #header { float: left; width: 185px; height: 600px; border: 1px solid blue; }
    #content { float: left; width: 680px; background: white; min-height: 600px; border: 1px solid lime; }
    #rightcolumn { float: left; width: 89px; height: 600px; border: 1px solid maroon; }
    </style>
    
    </head>
    <body>
    
    <div id="wrapper">
       <div id="header">
          header
       </div>
       <div id="content">
          content
       </div>
       <div id="rightcolumn">
          right
       </div>
    </div> 
    
    </body>
    </html>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>
        test
    </title>
    
        <!--[if lt IE 8]>
    
        <![endif]--> 
    
        <!--[if lt IE 7]>
    
        <![endif]--> 
    
    </head>
    
    <body style="margin: 10px;">
    <div id="wrapper" style="width: 960px; margin: 0 auto; position: relative;  border: 1px solid red; overflow: hidden;">
    
        <div id="header" style="width: 185px; float: left;  height: 600px;      top: 10px;      border: 1px solid blue;">
          header
        </div>
    
        <div id="content" style="width: 680px; float: center; background: white; margin-left: 185px;  min-height: 600px;      border: 1px solid lime;">
            content
        </div>
    
        <div id="rightcolumn" style="position: fixed; top: 10px; width: 95px; margin-left: 865px;   height: 600px;border: 1px solid maroon;">
            right
        </div>
    
    </div> 
    
    
    </body>
    </html>
    

    Это должно сделать это!

    Если решения на основе сценариев приемлемы, то я добился определенного успеха с фиксированными div-элементами (необязательно с использованием имеющегося макета) с помощью Дина Эдвардса ' сценарии обновления , которые исправляют поведение IE в соответствии с требованиями стандартов.

    Лицензировано под: CC-BY-SA с атрибуция
    Не связан с StackOverflow
    scroll top