- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要 body div 能够随着内容和我放置在其中的 div 一起增长,这样当内容在页面垂直向下增长时,body 背景也随之增长。这是当前问题的图片:http://prntscr.com/dyknn4看看正文中的蓝色背景是如何停止的,因为 BODY div 没有随着内容垂直扩展?-已经尝试过后台重复y
感谢您的帮助!
body{
min-height: 100%;
min-width:100%;
font-family: 'Open Sans', sans-serif;
background-image: url("images/background.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
height: 100vh;
}
/*LOGO*/
.logo ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: white;
}
.logo li img {
display: block;
text-align: center;
text-decoration: none;
}
/*NAVBAR*/
nav {
z-index: 1;
}
ul {
z-index: 1;
width: 100%;
height: 48px;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: fixed;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: white;
font-size: 125%;
color: black;
}
/*END NAVBAR*/
/*MAIN BODY DIV*/
.wrap {
top: 0;
position: relative;
height: 100%;
width: 70%;
background-image: url("images/backgroundmain.png");
left: 15%;
}
/*LOCAL WEATHER*/
.local {
z-index: -99999999;
position: absolute;
height: 40%;
width: 20%;
}
<body>
<!-- NAVBAR -->
<nav class="logo">
<ul>
<li><img src="images/Mlogo.png"></li>
</ul>
</nav>
<nav class="header">
<ul>
<li style="margin-left: 15%"><a href="index2.html">Home</a></li>
<li><a href="#contact">Contact Us</a></li>
<li><a href="#Services">Our Service</a></li>
<li><a href="#Map">Interactive Weather Map</a></li>
<li style="float:right; margin-right: 15%"><a href="#Login">Log In</a></li>
<li style="float:right;"><a href="#Signup">Sign Up</a></li>
</ul>
</nav>
<!-- END NAV -->
<!-- MAIN BODY -->
<div class="wrap">
<!-- LOCAL WEATHER -->
<div class="local">
<p>THIS IS A TEST Spicy jalapeno bacon ipsum dolor amet exercitation pig sausage, rump deserunt cow porchetta. Tenderloin strip steak brisket, meatloaf elit drumstick quis salami irure leberkas frankfurter. Aliqua ut ad, chicken biltong salami bresaola turkey labore ball tip short ribs in. Swine in ut short ribs. Ullamco in meatball venison. Ham hock aliquip dolore cupidatat est. Proident non tri-tip, tempor drumstick mollit veniam ham leberkas laborum tongue filet mignon in deserunt.
Esse tempor aliquip ullamco pork, picanha deserunt dolore pastrami lorem. Swine strip steak fatback beef ribs, incididunt esse cupim non. Tempor shankle jowl picanha exercitation salami. Pastrami tri-tip laboris culpa. Meatball ribeye prosciutto doner eiusmod dolore. Cupim shank spare ribs ground round sausage.
Brisket tail ground round turducken ullamco tongue drumstick anim duis lorem. Commodo labore prosciutto tri-tip capicola ut burgdoggen pig dolore laborum pork adipisicing tail duis. Reprehenderit aliqua tail corned beef. Porchetta ribeye nulla laboris. Corned beef et doner, brisket laboris proident pork loin irure qui ipsum. Ut aliqua strip steak, labore boudin pork esse salami ut burgdoggen occaecat landjaeger consectetur lorem aliquip.
Pork chop brisket andouille veniam proident boudin deserunt doner. Doner pork belly shoulder chicken in eu pariatur, pork chop dolor culpa duis ground round sint in picanha. Sunt drumstick consectetur, fugiat nisi meatball aute ex do boudin est ea adipisicing magna ad. Reprehenderit cow meatloaf ham hock irure turkey id aliquip brisket. Prosciutto cillum meatball non tenderloin sed. Chicken doner sausage, jowl adipisicing pork belly landjaeger ut strip steak tri-tip exercitation ea non cupim.
Fatback rump officia excepteur prosciutto lorem fugiat tri-tip in pork belly. Short ribs ut filet mignon, sint enim hamburger prosciutto voluptate in alcatra tongue rump duis sirloin ribeye. Reprehenderit esse ut, turducken fugiat consectetur tongue. Meatball short ribs do, enim burgdoggen ut swine rump labore. Cillum leberkas corned beef, pig et ex nostrud turkey.
Excepteur doner tenderloin short ribs ut ut incididunt sint. Ball tip pastrami eu fugiat venison mollit pork lorem. Reprehenderit ball tip proident cillum capicola. Porchetta frankfurter sed tail. Reprehenderit meatball ham hock deserunt aliquip jowl in pig incididunt exercitation beef laborum. Elit ipsum porchetta, ut veniam pork loin ea in sint enim consectetur. Shankle pork loin sirloin excepteur veniam t-bone.
In officia drumstick, consequat est beef ribs adipisicing. Pariatur alcatra swine flank eu deserunt jerky veniam ex pork. Bresaola ullamco short loin, enim spare ribs ground round flank deserunt swine irure dolore cow pork belly velit ribeye. Hamburger esse minim sirloin ribeye tongue quis consectetur. Veniam jerky voluptate sed beef. Chicken ut elit short ribs sirloin.
Sed ut kielbasa capicola tail pastrami in non. Venison occaecat proident laborum aliquip ad ham hock short ribs et frankfurter ea shoulder corned beef laboris deserunt. Rump ham pork tempor tail ham hock. Picanha turkey ea, dolore ipsum swine elit short loin short ribs ut strip steak pork chop. Sirloin shank burgdoggen frankfurter, occaecat sausage velit ex tongue turkey reprehenderit.
Shank do duis eiusmod ball tip brisket ex shankle quis sint bacon anim andouille corned beef. Hamburger turkey in, ea in pork dolore ribeye irure tail. Laborum boudin adipisicing spare ribs dolore consectetur meatloaf reprehenderit, esse aliqua. Brisket est burgdoggen jerky sint pancetta. Aute eu cupidatat ground round leberkas t-bone andouille beef ribs pastrami esse mollit shank. Id jerky pancetta voluptate chuck kevin hamburger ham hock.
Minim porchetta qui, frankfurter meatball nostrud dolore prosciutto dolore velit ad. Officia mollit occaecat duis meatloaf, ground round brisket sausage swine consectetur ipsum short loin cow. Commodo short loin short ribs ad aliquip. Picanha ut jerky, aliquip capicola sed esse venison salami fugiat magna ground round nostrud excepteur kevin. Voluptate meatloaf brisket tail qui jerky kielbasa bresaola aute cupidatat pork mollit. Est laboris nisi ut ut ipsum beef chuck, reprehenderit corned beef velit brisket sint shoulder. Officia rump incididunt dolor brisket qui.</p>
<!-- <img src="images/weatherphoto.png"> -->
</div>
最佳答案
main body div .wrap
没有增长有两个原因,首先它需要 min-height: 100%
,其次,它的内容 .local
具有 position: absolute
,这不允许其父级随其内容一起增长。
body{
min-height: 100%;
min-width:100%;
font-family: 'Open Sans', sans-serif;
background-image: url("images/background.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
height: 100vh;
}
/*LOGO*/
.logo ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: white;
}
.logo li img {
display: block;
text-align: center;
text-decoration: none;
}
/*NAVBAR*/
nav {
z-index: 1;
}
ul {
z-index: 1;
width: 100%;
height: 48px;
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
position: fixed;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: white;
font-size: 125%;
color: black;
}
/*END NAVBAR*/
/*MAIN BODY DIV*/
.wrap {
top: 0;
position: relative;
min-height: 100%;
width: 70%;
background-image: url("images/backgroundmain.png");
left: 15%;
background-color: lightblue;
}
/*LOCAL WEATHER*/
.local {
height: 40%;
width: 20%;
}
<body>
<!-- NAVBAR -->
<nav class="logo">
<ul>
<li><img src="images/Mlogo.png"></li>
</ul>
</nav>
<nav class="header">
<ul>
<li style="margin-left: 15%"><a href="index2.html">Home</a></li>
<li><a href="#contact">Contact Us</a></li>
<li><a href="#Services">Our Service</a></li>
<li><a href="#Map">Interactive Weather Map</a></li>
<li style="float:right; margin-right: 15%"><a href="#Login">Log In</a></li>
<li style="float:right;"><a href="#Signup">Sign Up</a></li>
</ul>
</nav>
<!-- END NAV -->
<!-- MAIN BODY -->
<div class="wrap">
<!-- LOCAL WEATHER -->
<div class="local">
<p>THIS IS A TEST Spicy jalapeno bacon ipsum dolor amet exercitation pig sausage, rump deserunt cow porchetta. Tenderloin strip steak brisket, meatloaf elit drumstick quis salami irure leberkas frankfurter. Aliqua ut ad, chicken biltong salami bresaola turkey labore ball tip short ribs in. Swine in ut short ribs. Ullamco in meatball venison. Ham hock aliquip dolore cupidatat est. Proident non tri-tip, tempor drumstick mollit veniam ham leberkas laborum tongue filet mignon in deserunt.
Esse tempor aliquip ullamco pork, picanha deserunt dolore pastrami lorem. Swine strip steak fatback beef ribs, incididunt esse cupim non. Tempor shankle jowl picanha exercitation salami. Pastrami tri-tip laboris culpa. Meatball ribeye prosciutto doner eiusmod dolore. Cupim shank spare ribs ground round sausage.
Brisket tail ground round turducken ullamco tongue drumstick anim duis lorem. Commodo labore prosciutto tri-tip capicola ut burgdoggen pig dolore laborum pork adipisicing tail duis. Reprehenderit aliqua tail corned beef. Porchetta ribeye nulla laboris. Corned beef et doner, brisket laboris proident pork loin irure qui ipsum. Ut aliqua strip steak, labore boudin pork esse salami ut burgdoggen occaecat landjaeger consectetur lorem aliquip.
Pork chop brisket andouille veniam proident boudin deserunt doner. Doner pork belly shoulder chicken in eu pariatur, pork chop dolor culpa duis ground round sint in picanha. Sunt drumstick consectetur, fugiat nisi meatball aute ex do boudin est ea adipisicing magna ad. Reprehenderit cow meatloaf ham hock irure turkey id aliquip brisket. Prosciutto cillum meatball non tenderloin sed. Chicken doner sausage, jowl adipisicing pork belly landjaeger ut strip steak tri-tip exercitation ea non cupim.
Fatback rump officia excepteur prosciutto lorem fugiat tri-tip in pork belly. Short ribs ut filet mignon, sint enim hamburger prosciutto voluptate in alcatra tongue rump duis sirloin ribeye. Reprehenderit esse ut, turducken fugiat consectetur tongue. Meatball short ribs do, enim burgdoggen ut swine rump labore. Cillum leberkas corned beef, pig et ex nostrud turkey.
Excepteur doner tenderloin short ribs ut ut incididunt sint. Ball tip pastrami eu fugiat venison mollit pork lorem. Reprehenderit ball tip proident cillum capicola. Porchetta frankfurter sed tail. Reprehenderit meatball ham hock deserunt aliquip jowl in pig incididunt exercitation beef laborum. Elit ipsum porchetta, ut veniam pork loin ea in sint enim consectetur. Shankle pork loin sirloin excepteur veniam t-bone.
In officia drumstick, consequat est beef ribs adipisicing. Pariatur alcatra swine flank eu deserunt jerky veniam ex pork. Bresaola ullamco short loin, enim spare ribs ground round flank deserunt swine irure dolore cow pork belly velit ribeye. Hamburger esse minim sirloin ribeye tongue quis consectetur. Veniam jerky voluptate sed beef. Chicken ut elit short ribs sirloin.
Sed ut kielbasa capicola tail pastrami in non. Venison occaecat proident laborum aliquip ad ham hock short ribs et frankfurter ea shoulder corned beef laboris deserunt. Rump ham pork tempor tail ham hock. Picanha turkey ea, dolore ipsum swine elit short loin short ribs ut strip steak pork chop. Sirloin shank burgdoggen frankfurter, occaecat sausage velit ex tongue turkey reprehenderit.
Shank do duis eiusmod ball tip brisket ex shankle quis sint bacon anim andouille corned beef. Hamburger turkey in, ea in pork dolore ribeye irure tail. Laborum boudin adipisicing spare ribs dolore consectetur meatloaf reprehenderit, esse aliqua. Brisket est burgdoggen jerky sint pancetta. Aute eu cupidatat ground round leberkas t-bone andouille beef ribs pastrami esse mollit shank. Id jerky pancetta voluptate chuck kevin hamburger ham hock.
Minim porchetta qui, frankfurter meatball nostrud dolore prosciutto dolore velit ad. Officia mollit occaecat duis meatloaf, ground round brisket sausage swine consectetur ipsum short loin cow. Commodo short loin short ribs ad aliquip. Picanha ut jerky, aliquip capicola sed esse venison salami fugiat magna ground round nostrud excepteur kevin. Voluptate meatloaf brisket tail qui jerky kielbasa bresaola aute cupidatat pork mollit. Est laboris nisi ut ut ipsum beef chuck, reprehenderit corned beef velit brisket sint shoulder. Officia rump incididunt dolor brisket qui.</p>
<!-- <img src="images/weatherphoto.png"> -->
</div>
关于html - Div自动高度以适应内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41783450/
我遇到了问题,似乎无法解决。 基本上,我希望我的菜单和文本随着分辨率的变化/放大/缩小而调整大小;图片工作正常,内容 div 工作正常,只是菜单似乎无法适应。 请帮我解决这个问题.. 普通 View
我在map reduce上开发了大约20个工作,包括pagerank算法。我从未发现任何具有挑战性的问题可以在线适应mapreduce框架。我想提高自己的技能。有这样的指南吗? 最佳答案 您正在寻找的
我了解到 Java 中没有 NOR,我可以使用 !A && !B 或 !(A||B)。既然 A 和 B 都是假的,为什么我不能使用 !A || B? 最佳答案 因为Java没有NOR运算符,你的表达式
我需要根据构建 CLI 工具的要求评估“GO”,该工具应该可以在不同的操作系统中运行。这是如何在诸如“Cloud Foundry CLI”之类的 CLI 工具中实现的?GO 如何处理这种对操作系统的适
所以我试图让我的下拉菜单正常工作。下拉列表位于我的标题中的列表项下,该列表项会根据用户的用户名而变化。这使得大小不同,但我无法让下拉菜单跟随宽度调整大小。 示例 1: http://jsfiddle.
我已经很努力了,但我还是被 matplotlib 卡住了。请忽略,mpl 文档让我有点困惑。我的问题涉及以下方面: 我用 matshow 函数画了一个对称的 n*n 矩阵 D。行得通。 我想做同样的事
我正在尝试调整 Boyer-Moore c(++) Wikipedia implementation获取字符串中模式的所有匹配项。实际上,维基百科实现返回第一个匹配项。主要代码如下: char* bo
我在底部嵌套了带有文本的 flex 元素。顶部元素具有小于文本的固定宽度: .list-header { display: flex; width: 150px; height: 80px
我想初始化 std::any带有仅 move 类型变量。我找到了 Cannot move std::any . 编译错误案例 在使用链接答案中的 shared_ptr 解决方法之前,我测试了以下代码:
现在我正在使用 webview 处理 ListView 。在这个 listview webview 中用于显示图像。它来自 url。现在我面临一个问题,我无法从 url 获得唯一尺寸的图像,一些图像很
我的文件夹结构是这样的: src --main.cpp tests --src ----main_test.cpp Makefile 我想制作一个像make main_test这样的目标,以便能够以.
前段时间我也在讨论类似的话题。我正在查看我的应用程序,我认为它有很多不必要的代码。我的意思是我有服务负责从两家书店的不同类别的书籍中抓取数据。现在我有 5 个类别,所以我有 5 个方法,但如果我要添加
我使用多个 div 子元素创建父元素,然后根据 data-value 属性在 JavaScript 中计算这些子元素的宽度。 如果我对所有 child 的计算宽度求和,我最终将得到 100%。但出于某
我像这样使用减速板 gem : require 'airbrake' Airbrake.configure do |config| config.api_key = 'XXXXX' confi
我们在企业环境中有一个 svn 存储库结构,如下所示: root libs shared_lib1 shared_lib2 private_lib public_cod
我制作了一个应用程序,其中有许多从 UIView 子类化的 View 。这些 View 的大小和方向是随机的,并且可以保存应用程序屏幕的状态。当用户在打开屏幕的同一设备上保存屏幕时,屏幕状态为“正常”
我需要调整 lucene 的 StandardTokenizer 以适应有关 twitter 数据的一些特殊目的。目前,我使用 StandardTokenizer 来标记一些我想要处理的推文。它工作得
在Windows Store应用中,如果内容是固定的,我们可以把它封装成一个ViewBox,让内容适应不同的分辨率。但是,如果内容不固定,在我的应用程序中,有一个 GridView 哪些项目是动态的,
一切都在标题中。 在我的应用程序中,根据用户所做的选择,我用一个列表填充一个组合框,该列表有时很小(1 个元素)有时很大(150 个元素)。 我想要的不是在启动时将固定高度设置为给定值,而是将 max
我的 2 div 动画感谢我下面的 jquery 脚本。当屏幕小于 700px 时,div 变成更小的正方形(35px 而不是 50px)。我希望 .animate({width:100px}); 仅
我是一名优秀的程序员,十分优秀!