html - 响应式文本
问题描述
我在制作响应式网站时遇到了一些问题。我想让页脚像页眉,但我无法处理它。我尝试了很多方法,但我不太擅长制作网站。如果你能帮助我应该使用什么来使页脚响应所有尺寸,请提供帮助。
这是我的 index.html 和 style.css
body {
font: 15px/1.5 Arial, Helvetica, sans-serif;
/*padding: 0;*/
margin: 0;
background-color: #e7e7e7;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
img {
padding-right: 55%;
padding-top: 22%;
/*width: 13%;*/
min-height: 10%;
}
.access {
transform: translate(-1%, -150%);
}
header {
background: #14a79d;
color: #ffffff;
text-align: center;
min-height: 70px;
margin-right: 18%;
margin-left: 18%;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
}
.footer {
position: relative;
background: #14a79d;
color: #ffffff;
text-align: center;
margin-right: 10%;
margin-left: 10%;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
.box {
text-align: center;
background-color: white;
height: 78vh;
background-size: cover;
margin-left: 10%;
margin-right: 10%;
}
/*footer {*/
/*position: fixed;*/
/*overflow: auto;*/
/*padding: 0 20px;*/
/*left: 0;*/
/*bottom: 0;*/
/*right: 0;*/
/*width: 60%;*/
/*margin-top: 100px;*/
/*color: #ffffff;*/
/*background-color: #14a79d;*/
/*text-align: center;*/
/*line-height: 50px;*/
/*padding: 0 20px;*/
/*margin-right: 18%;*/
/*margin-left: 18%;*/
/*height: 100%;*/
/*margin-top: -2%;*/
/*border-bottom-left-radius: 25px;*/
/*border-bottom-right-radius: 25px;*/
/*}*/
<header>
<div class="container">
<div id="denied">
<h1>Access Denied</h1>
</div>
</div>
</header>
<section id="boxes">
<div class="container">
<div class="box">
<img src="x.png">
<div class="access">
<h1 style="color: red;">Page Blocked</h1>
<p>You are attempting to access a forbidden Site.<br>It is blocked according to<br> the organization security policy.</p>
</div>
</div>
<div class="footer">
<p>© copyright ... 2018</p>
</div>
</div>
</section>
解决方案
这个怎么样?也许将页脚从主容器中取出会有所帮助。
body {
font: 15px/1.5 Arial, Helvetica, sans-serif;
padding: 0;
margin: 0;
background-color: #f4f4f4;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
header {
background: #14a79d;
color: #ffffff;
text-align: center;
height: 20vh;
margin-right: 18%;
margin-left: 18%;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
}
footer {
color: #ffffff;
background-color: #14a79d;
text-align: center;
margin-right: 18%;
margin-left: 18%;
height: 10vh;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
.box {
text-align: center;
background-color: grey;
height: 70vh;
background-size: cover;
margin-left: 10%;
margin-right: 10%;
}
<!DOCTYPE html>
<html>
<head>
<title>Access Denied</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device=width">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<div class="container">
<div id="denied">
<h1>Access Denied</h1>
</div>
</div>
</header>
<section id="boxes">
<div class="container">
<div class="box">
<img src="x.png">
<div class="access">
<h1 style="color: red;">Page Blocked</h1>
<p>You are attempting to access a forbidden Site.<br>It is blocked according to<br> the organization security policy.</p>
</div>
</div>
</div>
</section>
<footer>
<div class='container'>
<p>© copyright ... 2018</p>
</div>
</footer>
</body>
</html>
推荐阅读
- hibernate - 启发式完成:结果状态回滚;
- json - 我无法从 START_OBJECT 令牌中反序列化 `java.lang.String` 的实例
- python - 使用现有数据框中的值的新数据框
- list - 从 Lotus Notes 中读取所有类别
- c# - 允许用户灵活查询数据库但防止 SQL 注入
- docker - golang 应用程序的 Docker 临时图像找不到二进制“没有这样的文件或目录”
- android - 从 Sqlite 数据酶中获取数据并在 android studio 的 recyclerview 中显示
- matlab - PDF报告生成器中格式的表格字段 - Matlab
- c++ - Qt 通过回调更新 UI 中的图像
- blueprism - 为什么我的 HTML 元素可以在 Application Modeller 中识别,但不能在运行时识别?(蓝棱镜)