- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我很难让不均匀的三栏网站填满视口(viewport)的整个宽度。理想情况下,左栏将覆盖宽度的 25%,中间 50%,右侧 25%。如果我无法做到这一点,那么我会要求所有三列的“单位”本身在视口(viewport)中居中。现在,所有三列都向左挤压。最终解决方案的可移植性对我来说非常重要:无论是在浏览器方面还是在设备方面,所以我不想设置固定的宽度/高度。
body {
background-color: white;
color: white;
padding: 0px;
}
header {
background-color: #616161;
text-align: center;
width: 100%;
position: static;
padding-bottom: 15px;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
border-top-left-radius: 25px;
border-top-right-radius: 25px;
}
/* Style the top navigation bar */
.topnav {
overflow: hidden;
background-color: #0d47a1;;
height: 40px;
}
/* Style the topnav links */
.topnav a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change color on hover */
.topnav a:hover {
background-color: #5472d3;
color: black;
}
main {
background-color: #0d47a1;
margin-top: 15px;
margin-bottom: 15px;
padding: 15px;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
}
.row {
display: table;
margin-left: auto;
margin-right: auto;
}
/* Clear floats after the columns */
.row:after {
content: "";
clear: both;
}
.column {
padding: 15px;
background-color: #373737;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
border-radius: 25px;
margin:15px;
float: left;
}
.left .right {
width: 25%;
}
/* Middle column */
.middle {
width: 50%;
}
.card {
height: 100px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-radius: 25px;
}
article {
background-color: #8e8e8e;
padding-top: 15px;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
color: white;
margin-top: 15px;
}
section {
background-color: #616161;
padding-top: 15px;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
color: white;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-radius: 25px;
}
footer {
background-color: #616161;
margin: auto;
text-align: center;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
/* unvisited link */
a:link {
color: #fcd734;
}
/* visited link */
a:visited {
color: #5472d3;
}
a:hover {
text-decoration: underline;
}
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="main.css">
</head>
<body>
<header>
<h1>DASK: Divorced and Separated Koinonia</h1>
<br text-decoration: italic>Turning the dusk of divorce into new dawn.</br>
</header>
<nav class="topnav">
</nav>
<main>
<div class="row">
<section class="column left">
<section>
<article class="card">
<h4>Profile</h4>
<p>Coming soon</p>
</article>
<article class="card">
<h4>Forum Posts</h4>
<p>Coming soon</p>
</article>
</section>
<section style="margin-top: 15px">
<h3>Events</h3>
<p>Coming soon</p>
</section>
</section>
<section class="column middle">
<section>
<h2>What is DASK?</h2>
<p>
DASK, or Divorced and Separated Koinonia, is a retreat designed by and for
people who have experienced divorce and separation. It is founded in the
Catholic religious tradition, but all are welcome. DASK is based on the popular
Koinonia retreat.
</p>
<h2>What is Koinonia?</h2>
<p>
Koinonia is retreat program that is popular nation-wide, but was first founded
in Springfield, IL for adults. The word "koinonia" itself comes from the Greek
word for "community". The Koinonia retreat is run by many parishes, dioceses,
and college campuses in order to form communities and friendships based in
Christ. DASK finds that the focus on community is helpful to people going
through divorce and/or separation; we find that it is easy to feel "alone"
going through this process.
</p>
<p>
The theme of every DASK weekend is the Paschal Mystery; that is, the life,
death, and resurrection of Jesus.
</p>
<h2>Where can I get more information?</h2>
<li>Download our <a href="static/img/dask_brochure_2018.pdf">brochure</a>.</li>
<li>Like our <a href="https://www.facebook.com/daskretreats">Facebook page</a>.</li>
<li>Email us at <a href="mailto:daskretreatsk@gmail.com">daskretreats@gmail.com</a>.</li>
<li>Follow us on Twitter <a href="https://www.twitter.com/daskretreats">@daskretreats</a>.</li>
<h2>How do I sign up?</h2>
<p>
<a href="static/img/dask_brochure_2018.pdf">Download our brochure</a>, complete
the registration form inside, and submit it via snail mail or
<a href="mailto:daskretreats@gmail.com">email</a>. We host two retreat weekends
a year: in the Spring at Columbia, IL, and in the Fall at Springfield, IL.
</p>
</section>
</section>
<section class="column right">
<section>
<h4>Donate</h4>
<p>Coming soon</p>
</section>
<section style="margin-top: 15px">
<article class="card">
<h4>Twitter</h4>
<p>Coming soon</p>
</article>
<article class="card">
<h4>News</h4>
<p>Coming soon</p>
</article>
</section>
</section>
</div>
</main>
<footer>
<p>
Copyright (C) 2018: Divorced and Separated Koinonia, under the <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA</a>.
<br><a href="daskretreats@gmail.com.com">daskretreats@gmail.com</a>
</p>
</footer>
</body>
</html>
预先感谢您的帮助!
最佳答案
如果您要查找,请参阅以下代码。我采取几个步骤来实现它。起初你的选择器是错误的 .left .right
,这是选择 right inside left 它应该 .left, .right
。
body {
background-color: white;
color: white;
padding: 0px;
}
/* Added */
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
header {
background-color: #616161;
text-align: center;
width: 100%;
position: static;
padding-bottom: 15px;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
border-top-left-radius: 25px;
border-top-right-radius: 25px;
}
/* Style the top navigation bar */
.topnav {
overflow: hidden;
background-color: #0d47a1;;
height: 40px;
}
/* Style the topnav links */
.topnav a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change color on hover */
.topnav a:hover {
background-color: #5472d3;
color: black;
}
main {
background-color: #0d47a1;
margin-top: 15px;
margin-bottom: 15px;
padding: 15px;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
}
.row {
display: table;
margin-left: auto;
margin-right: auto;
}
/* Clear floats after the columns */
.row:after {
content: "";
clear: both;
}
.column {
padding: 15px;
background-color: #373737;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
border-radius: 25px;
margin:15px;
float: left;
}
.left, .right {
width: calc(25% - 30px); // Deducted margin space 15+15 = 30px;
}
/* Middle column */
.middle {
width: calc(50% - 30px); // Deducted margin space 15+15 = 30px;
}
.card {
height: 100px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-radius: 25px;
}
article {
background-color: #8e8e8e;
padding-top: 15px;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
color: white;
margin-top: 15px;
}
section {
background-color: #616161;
padding-top: 15px;
padding-right: 15px;
padding-bottom: 15px;
padding-left: 15px;
color: white;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-radius: 25px;
}
footer {
background-color: #616161;
margin: auto;
text-align: center;
box-shadow: 0 8px 12px 0 rgba(0, 0, 0, 0.2), 0 10px 24px 0 rgba(0, 0, 0, 0.19);
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
/* unvisited link */
a:link {
color: #fcd734;
}
/* visited link */
a:visited {
color: #5472d3;
}
a:hover {
text-decoration: underline;
}
<header>
<h1>DASK: Divorced and Separated Koinonia</h1>
<br text-decoration: italic>Turning the dusk of divorce into new dawn.</br>
</header>
<nav class="topnav">
</nav>
<main>
<div class="row">
<section class="column left">
<section>
<article class="card">
<h4>Profile</h4>
<p>Coming soon</p>
</article>
<article class="card">
<h4>Forum Posts</h4>
<p>Coming soon</p>
</article>
</section>
<section style="margin-top: 15px">
<h3>Events</h3>
<p>Coming soon</p>
</section>
</section>
<section class="column middle">
<section>
<h2>What is DASK?</h2>
<p>
DASK, or Divorced and Separated Koinonia, is a retreat designed by and for
people who have experienced divorce and separation. It is founded in the
Catholic religious tradition, but all are welcome. DASK is based on the popular
Koinonia retreat.
</p>
<h2>What is Koinonia?</h2>
<p>
Koinonia is retreat program that is popular nation-wide, but was first founded
in Springfield, IL for adults. The word "koinonia" itself comes from the Greek
word for "community". The Koinonia retreat is run by many parishes, dioceses,
and college campuses in order to form communities and friendships based in
Christ. DASK finds that the focus on community is helpful to people going
through divorce and/or separation; we find that it is easy to feel "alone"
going through this process.
</p>
<p>
The theme of every DASK weekend is the Paschal Mystery; that is, the life,
death, and resurrection of Jesus.
</p>
<h2>Where can I get more information?</h2>
<li>Download our <a href="static/img/dask_brochure_2018.pdf">brochure</a>.</li>
<li>Like our <a href="https://www.facebook.com/daskretreats">Facebook page</a>.</li>
<li>Email us at <a href="mailto:daskretreatsk@gmail.com">daskretreats@gmail.com</a>.</li>
<li>Follow us on Twitter <a href="https://www.twitter.com/daskretreats">@daskretreats</a>.</li>
<h2>How do I sign up?</h2>
<p>
<a href="static/img/dask_brochure_2018.pdf">Download our brochure</a>, complete
the registration form inside, and submit it via snail mail or
<a href="mailto:daskretreats@gmail.com">email</a>. We host two retreat weekends
a year: in the Spring at Columbia, IL, and in the Fall at Springfield, IL.
</p>
</section>
</section>
<section class="column right">
<section>
<h4>Donate</h4>
<p>Coming soon</p>
</section>
<section style="margin-top: 15px">
<article class="card">
<h4>Twitter</h4>
<p>Coming soon</p>
</article>
<article class="card">
<h4>News</h4>
<p>Coming soon</p>
</article>
</section>
</section>
</div>
</main>
<footer>
<p>
Copyright (C) 2018: Divorced and Separated Koinonia, under the <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA</a>.
<br><a href="daskretreats@gmail.com.com">daskretreats@gmail.com</a>
</p>
</footer>
关于HTML5/CSS3 : Three column site not filling viewport width,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49663965/
我想了解这两者的区别 谢谢 最大宽度:100px 宽度:100px body{ max-width: 1080px; width: 1080px; backgrou
jQuery 的 .width()、jQuery 的 .css('width') 和 .style 返回的值有什么区别.width 节点上的属性? 我很好奇,因为在尝试将两个表格单元格的宽度设置为相等
我可以在 wordpress 的 header php 中添加两个视口(viewport): 和 我希望能够使用 viewport width 1024 显示everything,除非您是低于 x
好的,所以我得到了 ImageBackground 的以下组件(使用 typescript ,但应该是不言自明的)。 (这是 react 原生的) import * as React from "re
我正在尝试根据 div 中包含的图像的宽度调整其大小,但没有任何 JS 方法可以一致地工作来获取图像的宽度。 label here img { width: auto
我有一个表,我试图找到表中每个 td 的宽度。我尝试了各种变体:$("td")[0].width(),但它们都不起作用,收到错误:"Uncaught TypeError: $ (...)[0].wid
我在使 rem 中的 min-width 与百分比宽度共存时遇到了一些问题。 When resizing this jsfiddle the outer right block is going un
当我在 chrome(以及 Edge/Brave/Opera)的设备模式下测试页面时,设备宽度属性似乎减少了,但宽度属性没有 重新创建: html {
我想依次显示 div #botone、#bottwo 和 #bottree。我还希望在 #botone div 上按 100% 宽度和比例高度调整背景图像。 现在最后两个 Div 显示在 #boton
我是第一次学习 JavaScript 的学生,我有一个学校问题,我们需要指出 width 和 style.width 接受的数据类型。 我知道数据类型有数字、字符串、空值、未定义、 bool 值和对象
所以看起来在移动设备中媒体查询使用 screen.width 根本没有改变。但是在我的桌面上,当我更改窗口大小时,screen.width 保持不变,$(window).width() 发生变化,并且
http://jsfiddle.net/3BFGU/27/ 有谁知道为什么包含文本“ABC”的跨度的宽度返回 0。 1) 仅在 Firefox 中发生。2)如果我删除两者之间的跨度,它工作正常。 (h
我知道下面的代码清除了 Canvas canvas.width = canvas.width 但这在内部是如何工作的呢? 赋值运算符只是将一些值赋给变量,但是上面的代码如何清除 Canvas ? 根据
当使用 max-width 时,为什么它不会“破坏”超过允许长度的单词,我该如何让它工作? JSFiddle function input() { var inputText = document
在移动网站上,在利用 width=device-width 视口(viewport)设置的同时调整文本大小的最佳方式是什么? 最佳答案 样式百分比如何?比如 100% 或 90%。 关于html -
对于我的 WPF Toolkit DataGrid,我使用以下自定义列标题样式:
过去,我看到下一个 css,我在想两者之间是否存在一些实际差异 min-width: 90px; max-width: 90px; 和 width: 90px; 最佳答案 使用 width 将简单地在
我有一个 R Markdown,我从 RStudio 中将其编织为 html。我可以使用 fig.width 和 fig.height 来调整我的绘图的分辨率,但我似乎无法加宽页面输出,以便文本输出不
此处的示例代码:http://pastebin.com/95z3pftQ 我正在尝试构建一个带有固定标题和“内容”部分的移动页面,该部分将填充外部(经过清理,但在其他方面是任意的)HTML。我需要使用
这里是 dp 单位的定义:(如果它是正确的...) 密度无关像素 - 一种基于屏幕物理密度的抽象单位。这些单位是相对于 160 dpi 屏幕而言的,因此 1 dp 是 160 dpi 屏幕上的一个像素
我是一名优秀的程序员,十分优秀!