gpt4 book ai didi

html - 我的内容没有在 div 内调整

转载 作者:行者123 更新时间:2023-11-28 17:53:24 24 4
gpt4 key购买 nike

My Screenshot of page

我是设计布局的新手。

我已经制作了这个布局,但每当我在其中添加更多文本或任何元素时,它都不会扩展容器内的内部 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>

最佳答案

你的内部“section”元素有 position:absolute;因此它不会“拉伸(stretch)”它包含元素的高度(设置为 500px)。你真正想做的不是使用 position:absolute;因此您的元素的高度可以使用“ float ”方法更加动态。

我会推荐以下内容: http://webdesign.about.com/od/csstutorials/ss/css_layout_sbs.htm

关于html - 我的内容没有在 div 内调整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21809850/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com