- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有什么方法可以在页面底部设置页脚吗?页脚应为 100% 宽度,.wrapper
也应为 960px。
我已经试过了:
position: relative;
- 粘在 .content
标签之间position: absolute;
- 坚持 .nav
position: fixed;
- 可能是一个解决方案,但我并不总是需要它,只是在最后一页的底部。.footer
移到 .wrapper
之外并设置 .wrapper:not(footer);
- 页脚贴在底部,但是宽度没有改变。 有什么建议可以将其设置在底部吗?
@charset "UTF-8";
@import url('https://fonts.googleapis.com/css?family=Montserrat|Nunito+Sans|Roboto&display=swap');
* {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
html {
scroll-behavior: smooth;
word-wrap: break-word;
}
html,
body,
header,
main {
height: 100%;
}
body {
width: 100%;
font-family: Roboto, Verdana, sans-serif;
font-size: 1em;
background-image: url(../images/extra_clean_paper.png);
background-repeat: repeat;
}
header {
text-align: center;
background-color: yellow;
}
#hero-header {
position: relative;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#hero-btn {
width: 50px;
height: 50px;
position: absolute;
bottom: 4em;
left: 50%;
-webkit-transform: translateX(-50%);
-ms-transform: translateX(-50%);
transform: translateX(-50%);
}
.hero-btn a {
position: relative;
display: inline-block;
color: black;
text-decoration: none;
-webkit-transition: opacity .3s;
-o-transition: opacity .3s;
transition: opacity .3s;
}
.hero-btn a:hover {
opacity: 0.5;
}
header a {
padding-top: 70px;
}
header a span {
position: absolute;
top: 0;
left: 50%;
width: 24px;
height: 24px;
margin-left: -12px;
border-left: 1px solid black;
border-bottom: 1px solid black;
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-animation: sdb07 2s infinite;
animation: sdb07 2s infinite;
opacity: 0;
}
header a span:nth-of-type(1) {
-webkit-animation-delay: 0s;
animation-delay: 0s;
}
header a span:nth-of-type(2) {
top: 16px;
-webkit-animation-delay: .15s;
animation-delay: .15s;
}
header a span:nth-of-type(3) {
top: 32px;
-webkit-animation-delay: .3s;
animation-delay: .3s;
}
@-webkit-keyframes sdb07 {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
@keyframes sdb07 {
0% {
opacity: 0;
}
50% {
opacity: 1;
}
100% {
opacity: 0;
}
}
#resp-nav {
text-align: center;
display: none;
background-color: grey;
}
#resp-nav i {
font-size: 2em;
color: white;
}
#nav {
text-align: center;
background-color: dimgray;
z-index: 2;
}
main:not(#footer) {
max-width: 960px;
margin: 0 auto;
}
.container {
background-color: #eeeeee;
border: 1px solid red;
border-radius: 5px;
clear: both;
overflow: hidden;
margin-top: 1em;
min-height: 100%;
padding: 3.125em 0.625em;
-webkit-box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
}
.aboutme img {
width: 100%;
height: auto;
}
.aboutme .col-40 {
margin-top: 1em;
padding-left: 1em;
padding-right: 1em;
width: 39%;
}
.aboutme .col-60 {
margin-top: 1em;
padding-left: 1em;
padding-right: 1em;
width: 59%;
}
.left {
float: left;
}
.right {
float: right;
}
.table {
display: table;
border-collapse: collapse;
table-layout: fixed;
}
.hobbies .table-row {
display: table-row;
border-bottom: 0.1em solid darkgrey;
}
.hobbies .table-row:last-child {
border: 0;
}
.hobbies .table-cell {
display: table-cell;
padding-left: 1em;
padding-right: 1em;
vertical-align: middle;
text-align: center;
width: 50%;
}
.portfolio .col-50 {
margin-top: 1em;
padding-left: 1em;
padding-right: 1em;
width: 49%;
}
.projects .flex-row {
display: flex;
flex-wrap: wrap;
width: 100%;
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.projects .col-33 {
position: relative;
width: 100%;
max-width: 33%;
-ms-flex: 0 0 33%;
-webkit-box-flex: 0;
-webkit-flex: 0 0 33%;
flex: 0 0 33%;
}
.projects .services-box {
background: #f9f9f9;
padding: 10px;
margin: 20px 5px 0 5px;
}
footer {
background: red;
height: 50px;
width: 100%;
position: relative;
bottom: 0;
left: 0;
margin-top: 10px;
}
<header id="link-hero-page">
<div id="hero-header">
</div>
</header>
<nav>
<ul id="nav">
</ul>
</nav>
<main>
<section id="link-main" class="aboutme container">
<div class="col-40 left">
</div>
<article class="col-60 right">
</article>
</section>
<section id="link-hobbies" class="hobbies container">
<div class="table">
<div class="table-row">
<article class="table-cell">
</article>
</div>
<div class="table-row">
<div class="table-cell">
</div>
<article class="table-cell">
</article>
</div>
<div class="table-row">
<article class="table-cell">
</article>
</div>
</div>
</section>
<section id="link-portfolio" class="portfolio container">
<article class="col-50 left">
</article>
<article class="col-50 right">
</article>
</section>
<section id="link-projects" class="projects container">
<div class="flex-row">
<div class="col-33">
<article class="services-box">
</article>
</div>
<div class="col-33">
<article class="services-box">
</article>
</div>
<div class="col-33">
<article class="services-box">
</article>
</div>
</div>
</section>
<section id="link-contacts" class="contacts container">
</section>
</main>
<!--FOOTER-->
<footer>
<address>
<p style="text-align: center;">LOREM LOREM LOREM LOREM LOREM</p>
</address>
</footer>
最佳答案
一个选择是将你的容器变成一个垂直的 flexbox,并在页脚上设置 margin-top: auto
,这会将它推到 flex 容器的底部。您还需要在容器上设置 height: 100%
以便它填满整个页面
* {
margin: 0;
padding: 0;
}
html,
body {
height: 100%;
}
body {
width: 100%;
}
.nav {
background: green;
height: 50px;
}
.wrapper {
max-width: 500px;
margin: 0 auto;
display: flex;
flex-direction: column;
height: 100%;
}
.content {
background: yellow;
margin-top: 10px;
height: 100px;
}
.footer {
background: red;
height: 50px;
width: 100%;
position: relative;
margin-top: auto;
bottom: 0;
left: 0;
}
<body>
<div class="nav"></div>
<div class="wrapper">
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
<div class="footer"></div>
</div>
</body>
关于html - 页脚 float 到页面中间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56386784/
有人可以给我一个更简单的以下代码的解决方案(它正在展开给定结构 0xFC :: len :: payload :: ... :: 0x0A :: 0x0D 的整数列表): object Payload
我已经在我的网站上安装了 SSL 证书,但 intermediate.crt 无法正常工作。任何 SSL 检查器(例如 GeoTrust Checker)都告诉我,缺少中间 key 。网站上已经使用了
如何让图像从这个框的中间开始? (中间纵横) 最佳答案 有几种方法可以做到这一点,如果它需要在所有浏览器(IE7+ 和其他浏览器)中工作,你需要做不同的事情来让它在某些情况下工作。 使用绝对位置
如何强制 min-height 和 vertical-align:middle 为 td 元素或其内部元素工作? 最佳答案 td 元素上的 height 等同于 min-height,因为如果需要,表
我正在尝试自动滚动到订单簿的中间行。 我有 orderBook div,其中放置了带有 orderBook 的表。该表的其中一行有一个 id middleRow。我想做的是滚动该行并将其放置在 ord
我正在尝试在 javascript 中计算绝对定位元素的 transform-origin 属性,以便它们在悬停时填充整个视口(viewport)。 我尝试通过 x 除以窗口宽度和 y 除以窗口高度来
我有休闲字符串 ' this is my string ' 是否可以删除开头和结尾的所有空格,只在单词之间留一个空格。 要选择我使用过的所有空间: SELECT regexp_replace('
我正在设法创建我的第一个复杂的 J2E 解决方案,并且在每个教程中我都发现了某种中间表的用法,如下所示: 表:用户、用户角色、角色虽然逻辑会简单地向用户表添加一个键来引用它在角色表上的角色,但为什么要
我正在寻找以下解决方案。我想定位一个图像元素,例如 在中间。所以高度是视口(viewport)的高度,宽度会自动设置,图像的中间应该在视口(viewport)宽度的中间。 我搜索的一个例子就像下面的网
我正在设计一种布局,它更像是注册用户的个人仪表板。我让它变得简单,使用基本的 2 列网格,一个用于侧边栏,一个用于主要内容。 因为,例如,80% 的网站使用将发生在一个单独的子系统中,在无 chrom
我有三个不同的 div 标签(不在彼此内部)和代码,所以它有一个把单词放在左边、中间或右边,但中心非常偏离中心。这是 HTML 代码: .desc { float: right; color:
我有以下CSS http://jsbin.com/azivip/75/edit我想让黄色的 div 高度填充蓝色和绿色 div 之间的空间。使用高度继承似乎使 div 超出了绿色 div。 有什么想法
我不得不在其父元素的中间放置一些文本。我用下面的代码实现了它: #div1 { position: relative; margin: 0; padding: 0; } #div2 {
发现一个使用合法证书(由thawte 签名)的网站,但所有浏览器都会拒绝它。我不明白为什么。thawte 的支持告诉我一个域有两个证书,然后将这个 https://www.sslshopper[dot
我正在尝试使用 OpenSSL 创建证书链,但出于某种原因,当我在我的计算机上安装我的根 CA 并尝试验证证书链时,它总是告诉我它找不到证书的颁发者.为了让事情发生,我必须安装中间 CA,这是没有意义
我看到 REST 的一大好处是依赖 HTTP 缓存。我不是在争论这个,而是完全认同这个想法。但是,我从来没有看到对中间 HTTP 缓存的更深入的解释。 如果我将 Cache-control heade
查看此图片 Facebook Messenger Android App Buttons ( MESSENGER\ACTIVE ) 我怎样才能做到这一点? 详细信息:- 带有 2px 红色边框的 di
我的任务是制作漂亮的文本,在文本中间加一条白线,如下图所示。是否可以使用 css 来实现?这是 Fiddle .container{ height:200px; width:400px;
在拉丁文字中,字母有大写和小写形式。在 Python 中,如果你想比较两个字符串而不考虑它们的大小写,你可以使用 'string'.upper() 或 'string'.lower() 将它们转换为相
我正在使用 awk 对文件进行一些文本处理。例如删除尾随空格。 awk '{gsub(/ +$/, "")} {print $0}' filename 这很好用。但是当我将输出重定向到原始文件时。它变
我是一名优秀的程序员,十分优秀!