2014-02-16 2 views
1

My Screenshot of pageМое содержимое не подстраиваясь внутри DIV

Я новичок в разработке макета.

Я сделал этот макет, но он не расширяет внутренний div внутри контейнера всякий раз, когда я добавляю больше текста или любого элемента внутри него. любезно исправьте мой css.

Вот CSS моего макета

@charset "utf-8"; 
/* CSS Document */ 
@media only screen 
{ 
#fullPage 
{ 
    width:1100px; 
    height:850px; 
    position:relative; 
    margin:auto; 
    background-color:#999999; 
} 
    header 
{ 
    width:100%; 
    height:200px; 
    position:relative; 
    background-color:red; 
} 
header > nav 
{ 
    width:50%; 
    height:50%; 
    margin:auto; 
    position:relative; 
    background-color:lime; 
} 
#mobile 
{ 
    display:none; 
    background-color:orange; 
} 
#fullPage > section 
{ 
    width:100%; 
    height:100%; 
    min-height:500px; 
    position:relative; 
    background-color:yellow; 
} section > aside, section > section 
{ 
    width:500px; 
    height:100%; 
    position:absolute; 
    top:0px; 
    left:0px; 
    background-color:pink; 
} 
section > aside~aside 
{ 
    width:100px; 
    left:1000px; 
} 
section > section 
{ 
    left:500px; 
    background-color:blue; 
} 
footer 
{ 
    width:100%; 
    height:150px; 
    position:relative; 
    background-color:red; 
} 
} 
@media only screen and (max-width:1024px) and (min-width:801px) 
{ 
#fullPage 
{ 
    width:1000px; 
} 
header > nav 
{ 
    background-color:pink; 
} 
section > aside~aside 
{ 
    display:none; 
} 
} 
@media only print 
{ 
} 
@media only screen and (max-width:800px) 
{ 
#fullPage 
{ 
    width:640px; 
    height:1350px; 
} 
header 
{ 
    background-color:lime; 
} 
header > nav 
{ 
    width:75%; 
    height:50%; 
    margin:auto; 
} 
#mobile 
{ 
    display:block; 
} 
#desktop 
{ 
    display:none; 
} 
#fullPage > section 
{ 
    height:1000px; 
} 
section > aside, section > section 
{ 
    width:100%; 
    height:50%; 
    position:relative; 
    left:0px; 
} 
section > aside~aside 
{ 
    display:none; 
} 
} 

Это мой HTML

<div id="fullPage"> 
<header> 
    <nav id="desktop">DESKTOP</nav> 
    <nav id="mobile">MOBILE</nav> 
</header> 
<section> 
<aside>menu-1</aside> 
<section>Lorem Ipsum is Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.There are many variations of passages of Lorem Ipsum available, but the majority</section> 
<aside>menu-2</aside> 
</section> 
<footer>footer-1</footer> 
</div> 
+0

CSS без HTML, чтобы применить его к довольно бессмысленно/бесполезно. –

+0

http://feb.imghost.us/EycU.png –

+0

картинка рендеринга html тоже бесполезна ... показать ACTUAL html ... только html. нам не нужно текстовое содержимое. –

ответ

1

Ваш внутренний элемент "раздела" имеет позицию: абсолютная; следовательно, он не «растягивается», он содержит высоту элемента (установлен на 500 пикселей). Что вы на самом деле хотите сделать, это не использовать позицию: absolute; поэтому высоты ваших элементов могут быть более динамически, используя методологию «float».

я бы рекомендовал после этого: http://webdesign.about.com/od/csstutorials/ss/css_layout_sbs.htm

+0

Спасибо ronen. Он работал, но как сделать такой же эффект без использования float? –

+0

Если это на самом деле работает для вас, рейтинг будет оценен очень высоко :-) Могу ли я спросить, почему вы хотите избежать использования «плавания»? Похоже, это именно то, что вам следует делать ... –

+0

Да. Я просто хочу изучить этот эффект, не используя float. –

Смежные вопросы