Jump to content
  • 0

Один div над другим


Sam Trammell
 Share

Question

Верстаю резиновый сайт на div-ах. Всего три блога: 2 слева один над другим, 3-ий справа. Проблема в том, что в разных браузерах отображается по-разному: если в FF всё нормально, то в IE div-ы либо наслаиваются... и наоборот.

<div id="page">
<div class="sid">
<div class="trans"></div>
<div class="text">
Боковая flash-колонка (sidebar)</div>
</div>

<div id="page">
<div class="name">
<div class="trans"></div>
<div class="text">
Логотип (Dream Design)</div>
</div>

<div class="note">
<div class="trans"></div>
<div class="text">
Основная часть (page)</div>
</div>


<ul id="menu">
<li><a href="#">Главная</a></li>
<li><a href="#">О компании</a></li>
<li><a href="#">Продукция</a></li>
<li style="border:0 !important; font-family: Arial;"><a href="#">Контакты</a></li>
</ul>
</div>
</div>

CSS:

#page{
position:absolute;
top:0;bottom:0;right:0;left:0;
z-index:1;
height:100%;
}
.note{
border:0px solid #ddd;
margin:2% 12% 0 0px;
width:57%;
float:right;
min-height:80%;
height:auto !important;
position:relative;
}
.text{
position:relative;
padding:10px;
font-family: Arial;
font-size: 14px;
}
.sid{
border:0px solid #ddd;
width:18%;
float:left;
position:relative;
min-height:53%;
height:53%;
margin-left: 12%;
margin-top: 19%;
}
.name{
border:0px solid #ddd;
width:18%;
float:left;
position:relative;
min-height:25%;
margin-top: 2%;
margin-left: 12%;
height: 25%;
}
ul#menu{
position:absolute;
margin: 55% auto 0 2%;
left:26%;
font-size: 14px;
font-family: Arial;
}
#menu li{
float:left;
list-style:none;
width:130px;
text-align:center;
border-right:1px solid #333;
}
#menu li a{
text-decoration:none;
font-style: normal;
color:#fff;
border-bottom:1px dashed transparent;
}
#menu li a:hover{
text-decoration:none;
color:#fff;
border-bottom:1px dashed #ddd;
}

1.jpg

Хелп!

Edited by Sam Trammell
Link to comment
Share on other sites

15 answers to this question

Recommended Posts

  • 0
Теперь по существу уже можно? Или еще что-то не так?)

Вот теперь другое дело.

Думаю смысл понятен?

<!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=utf-8" />
<title>Документ без названия</title>
<style type="text/css">
*{ margin: 0; padding:0}
body { width: 800px; margin: 20px auto;}
.aside { float: left; width: 300px; margin-right: 20px;}
.right { overflow:hidden; background: blue;}
.left1,.left2 { height: 300px; margin-bottom: 20px; background: red;}

</style>
</head>


<body>
<div class="aside">
<div class="left1"></div>
<div class="left1"></div>
</div>
<div class="right">Right Content</div>
</body>
</html>

Link to comment
Share on other sites

  • 0
Хотя... Если задавать ширину div-ам в % - всё в порядке, если длину - всё пропадает. (Это я балуюсь с твоим примером).

Сайт ведь резиновый...((

т.е. ты хочешь колонки одинаковой высоты?

Link to comment
Share on other sites

  • 0

А вот это уже сложнее дружище, тяжёлая артилерия так сказать

<!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=utf-8" />
<title>Документ без названия</title>
<style type="text/css">
*{ margin: 0; padding:0}
html,body { height: 100%;}
.wrap {
width: 800px;
margin: 20px auto 0;
overflow: hidden;
border: 1px solid #900;
position: relative;
}
.aside { position: absolute; height: 100%; width: 300px; top: 0; bottom: 0; }
.right {
position: relative;
background: blue;
min-height: 200px;

margin-left: 320px;
}
.left1,.left2 { background: red;position: absolute;left: 0; width: 100%;}
.left1 { height: 20%; margin-bottom: 20px; top: 0;}
.left2 { bottom: 0; height: 78%; }

</style>
</head>


<body>
<div class="wrap">
<div class="aside">
<div class="left1">Left1</div>
<div class="left2">Left2</div>
</div>
<div class="right">Right Content</div>
</div>
</body>
</html>

Link to comment
Share on other sites

  • 0
Очень круто! Только в IE левая колонка не отображается.(

Добавь сразу для ИЕ6-7

.aside {

position: absolute;

height: 100%;

width: 300px;

height: auto;

top: 0;

bottom: 0;

_height: expression(this.parentNode.offsetHeight-0+'px');

left: 0;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Обсуждения

    • Актуальные контакты: Telegram: @Nikker_web E-Mail:   tarasevich.email@gmail.com Портфолио https://www.behance.net/d4d4186e Разрабатываю дизайн групп в соц сетях, сайтов, приложений, другой дизайн под заказ    
    • Актуальные контакты: Telegram: @Nikker_web E-Mail:   tarasevich.email@gmail.com   Разрабатываю дизайн групп в соц сетях, сайтов, приложений, другой дизайн под заказ   Портфолио https://www.behance.net/d4d4186e
    • Доброго всем времени суток. Прошу помощи. Научите принципу изменения футера. Движок Xenforo. Версия 2.2.10. Стиль дефолтный. Что именно нужно в итоге на фото примере. Мой шаблон app.footer less имеет следующее значение.  .p-footer { .xf-publicFooter(); a { .xf-publicFooterLink(); } } .p-footer-inner { .m-pageWidth(); .m-pageInset(); padding-top: @xf-paddingMedium; padding-bottom: @xf-paddingLarge; } .p-footer-row { .m-clearFix(); margin-bottom: -@xf-paddingLarge; } .p-footer-row-main { float: left; margin-bottom: @xf-paddingLarge; } .p-footer-row-opposite { float: right; margin-bottom: @xf-paddingLarge; } .p-footer-linkList { .m-listPlain(); .m-clearFix(); > li { float: left; margin-right: .5em; &:last-child { margin-right: 0; } a { padding: 2px 4px; border-radius: @xf-borderRadiusSmall; &:hover { text-decoration: none; background-color: fade(@xf-publicFooterLink--color, 10%); } } } } .p-footer-rssLink { > span { position: relative; top: -1px; display: inline-block; width: 1.44em; height: 1.44em; line-height: 1.44em; text-align: center; font-size: .8em; background-color: #4682B4; border-radius: 2px; } .fa-rss { color: white; } } .p-footer-copyright { margin-top: @xf-elementSpacer; text-align: center; font-size: @xf-fontSizeSmallest; } .p-footer-debug { margin-top: @xf-paddingLarge; text-align: right; font-size: @xf-fontSizeSmallest; .pairs > dt { color: inherit; } } @media (max-width: @xf-responsiveMedium) { .p-footer-row-main, .p-footer-row-opposite { float: none; } .p-footer-copyright { text-align: left; padding: 0 4px; // aligns with other links } }  
    • Нужны сайты с примерами верстки, типа https://css-tricks.com/. Типовые приемы и нестандартные на все случаи жизни. Накидайте ссылок.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy