我的底部边框在屏幕宽度 <700 像素时不可见。如何在页面底部和底部边框之间添加一些 space?
My bottom border is not viewable @ screen width <700 px. How do I add some space between the bottom of the page and my bottom border?
从上图@屏幕宽度700px以下的2张图片可以看出,我的上边框可以清楚地看到,而我的下边框卡在页面底部,无法查看。知道如何解决这个问题吗?我想在网页底部和我的底部边框之间有一些 space。
即使在调整主要元素或最外层 div 容器的边距后,我仍然无法在网页的底部边距和底端之间获得一些额外的 space 来呈现.
下面附上我的代码:
https://jsfiddle.net/gsy1m0w7/
CSS:
main {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border: 1px solid grey;
width: 70vw;
border-radius: 5px;
margin: auto;
background-color: white;
}
section {
/* background-color: greenyellow; */
height: 400px;
width: 350px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
margin: 10px 0;
}
div {
/* background-color: red; */
/* border-color: 3px solid black; */
display: inline;
text-align: center;
padding: 0 20px;
}
img#img1 {
height: 100px;
width: 100px;
margin-bottom: 10px;
}
section.panel {
border-right: 1px solid grey;
}
a {
text-transform: uppercase;
font-family: 'Merriweather', serif;
text-decoration: none;
font-size: 0.8rem;
}
#main_container {
display: flex;
align-items: center;
height: 100vh;
}
button {
margin-bottom: 10px;
text-transform: uppercase;
font-family: 'Merriweather', serif;
padding: 8px 13px;
border-radius: 5px;
}
a.price {
font-weight: bold;
font-size: 1.7rem;
}
button:hover {
background-color: skyblue;
}
hr {
width: 50%;
}
span {
display: block;
height: 8px;
margin-bottom: 8px;
}
@media (max-width: 700px) {
main {
display: flex;
flex-direction: column;
margin-bottom: 100px;
}
section {
/* background-color: greenyellow; */
/* height: 400px;
width: 350px; */
display: flex;
width: 70vw;
}
section.panel {
border-right: none;
border-bottom: 1px solid grey;
}
div {
flex-wrap: wrap;
}
button {
margin-bottom: 30px;
}
#main_container {
margin-bottom: 10px;
height: 0px;
}
}
HTML:
<div id="main_container">
<main>
<section class="panel" id="panel1">
<img id="img1" src="rocket.gif" alt=""><a href="">Personal</a>
<hr>
<div><a href="">Custom Domain</a></div>
<hr>
<div><a href="">Sleeps After 30 Mins Of Inactivity</a></div>
<hr>
<div><a class="price" href="">Free</a></div>
<div>
<button>SIGN UP</button>
</div>
</section>
<section class="panel" id="panel2">
<img id="img1" src="target.gif" alt=""><a href="">Small Team</a>
<hr>
<div><a href="">Never Sleeps</a></div>
<hr>
<div><a href="">Multiple Workers For More Powerful Apps</a></div>
<hr>
<div><a class="price" href="">0</a></div>
<div>
<button>FREE TRIAL</button>
</div>
</section>
<section id="panel3">
<img id="img1" src="presentation.gif" alt=""><a href="">Enterprise</a>
<hr>
<div><a href="">Dedicated</a></div>
<hr>
<div><a href="">Simple Horizontal Scalability</a></div>
<hr>
<div><a class="price" href="">0</a></div>
<div>
<button id="lastbutton">FREE TRIAL</button>
</div>
</section>
</main>
</div>
将#main_container设置为高度:100%;
对 <main>
的顶部和底部应用填充。这样做将使 main
相对于其中的任何内容始终流畅。
顶部和底部仅 50 像素内边距。
main{
padding: 50px 0;
}
从上图@屏幕宽度700px以下的2张图片可以看出,我的上边框可以清楚地看到,而我的下边框卡在页面底部,无法查看。知道如何解决这个问题吗?我想在网页底部和我的底部边框之间有一些 space。
即使在调整主要元素或最外层 div 容器的边距后,我仍然无法在网页的底部边距和底端之间获得一些额外的 space 来呈现.
下面附上我的代码:
https://jsfiddle.net/gsy1m0w7/
CSS:
main {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border: 1px solid grey;
width: 70vw;
border-radius: 5px;
margin: auto;
background-color: white;
}
section {
/* background-color: greenyellow; */
height: 400px;
width: 350px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
margin: 10px 0;
}
div {
/* background-color: red; */
/* border-color: 3px solid black; */
display: inline;
text-align: center;
padding: 0 20px;
}
img#img1 {
height: 100px;
width: 100px;
margin-bottom: 10px;
}
section.panel {
border-right: 1px solid grey;
}
a {
text-transform: uppercase;
font-family: 'Merriweather', serif;
text-decoration: none;
font-size: 0.8rem;
}
#main_container {
display: flex;
align-items: center;
height: 100vh;
}
button {
margin-bottom: 10px;
text-transform: uppercase;
font-family: 'Merriweather', serif;
padding: 8px 13px;
border-radius: 5px;
}
a.price {
font-weight: bold;
font-size: 1.7rem;
}
button:hover {
background-color: skyblue;
}
hr {
width: 50%;
}
span {
display: block;
height: 8px;
margin-bottom: 8px;
}
@media (max-width: 700px) {
main {
display: flex;
flex-direction: column;
margin-bottom: 100px;
}
section {
/* background-color: greenyellow; */
/* height: 400px;
width: 350px; */
display: flex;
width: 70vw;
}
section.panel {
border-right: none;
border-bottom: 1px solid grey;
}
div {
flex-wrap: wrap;
}
button {
margin-bottom: 30px;
}
#main_container {
margin-bottom: 10px;
height: 0px;
}
}
HTML:
<div id="main_container">
<main>
<section class="panel" id="panel1">
<img id="img1" src="rocket.gif" alt=""><a href="">Personal</a>
<hr>
<div><a href="">Custom Domain</a></div>
<hr>
<div><a href="">Sleeps After 30 Mins Of Inactivity</a></div>
<hr>
<div><a class="price" href="">Free</a></div>
<div>
<button>SIGN UP</button>
</div>
</section>
<section class="panel" id="panel2">
<img id="img1" src="target.gif" alt=""><a href="">Small Team</a>
<hr>
<div><a href="">Never Sleeps</a></div>
<hr>
<div><a href="">Multiple Workers For More Powerful Apps</a></div>
<hr>
<div><a class="price" href="">0</a></div>
<div>
<button>FREE TRIAL</button>
</div>
</section>
<section id="panel3">
<img id="img1" src="presentation.gif" alt=""><a href="">Enterprise</a>
<hr>
<div><a href="">Dedicated</a></div>
<hr>
<div><a href="">Simple Horizontal Scalability</a></div>
<hr>
<div><a class="price" href="">0</a></div>
<div>
<button id="lastbutton">FREE TRIAL</button>
</div>
</section>
</main>
</div>
将#main_container设置为高度:100%;
对 <main>
的顶部和底部应用填充。这样做将使 main
相对于其中的任何内容始终流畅。
顶部和底部仅 50 像素内边距。
main{
padding: 50px 0;
}