[英]How to make Jumbotron in col-md-6 placed in the center on both side?
The problem is, my Jumbotron placed on the upper side of the page. 问题是,我的Jumbotron放在页面的上方。 I want to move it to the center (a little down below).
我想将其移至中心(下方略微向下移动)。 I tried overriding margin and padding but it still didn't work.
我尝试覆盖边距和填充,但仍然无法正常工作。 How would I do that?
我该怎么办?
Here's my HTML 这是我的HTML
<div class="col-md-6">
<div class="welcome-page-eat">
<div class="jumbotron">
<h2>
Hello, world!
</h2>
<p>
This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.
</p>
<p>
<a class="btn btn-primary btn-large" href="#">Learn more</a>
</p>
</div>
</div>
</div>
And here's my CSS: 这是我的CSS:
.welcome-page-eat {
background: url(../images/front_page/eat.jpg) no-repeat right 0;
margin-right: -15px;
margin-left: -15px;
padding-bottom: 62.5%;
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: cover;
}
.welcome-page-cook {
background: url(../images/front_page/cook.jpg) no-repeat right 0;
margin-right: -15px;
margin-left: -15px;
padding-bottom: 62.5%;
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: cover;
}
.jumbotron {
background-color: transparent;
color: white;
}
Try using: 尝试使用:
.jumbotron {
background-color: transparent;
color: white;
margin: auto;
width: 90%;
} }
Maybe this article can help you: W3CSchools | 也许这篇文章可以帮助您: W3CSchools | CSS Margin
CSS保证金
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.