我正在为网站构建网格模板。我还想有一个CSS类模板来放置按钮。按钮类模板应具有以下位置:
我不太确定该如何制作CSS?该图像用作背景图像。
我希望有人帮我解决这个问题吗?
Link to the code on Online Bootstrap Editor
<style>
.d-flex {
display: -ms-flexbox!important;
display: flex!important
}
.d-inline-flex {
display: -ms-inline-flexbox!important;
display: inline-flex!important
}
.flex-wrap {
-ms-flex-wrap: wrap!important;
flex-wrap: wrap!important
}
.bg-img {
background-position: center center;
background-size: cover;
background-repeat: no-repeat; }
/* CTA Buttons */
.btn-top-left {
}
.btn-top-right {
}
.btn-center {
}
.btn-bottom-left {
}
.btn-bottom-right {
}
/* :: Set overlay over image and placement of text */
.single-welcome-post {
position: relative;
z-index: 1; }
.single-welcome-post::after {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.4);
content: '';
z-index: 5; }
.single-welcome-post .welcome-post-content {
position: absolute;
z-index: 100;
left: 50px;
bottom: 50px;
right: 50px; }
@media only screen and (min-width: 768px) and (max-width: 991px) {
.single-welcome-post .welcome-post-content {
left: 20px;
bottom: 20px;
right: 20px; } }
@media only screen and (max-width: 767px) {
.single-welcome-post .welcome-post-content {
left: 15px;
bottom: 15px;
right: 15px; } }
.single-welcome-post.style-2 {
height: 645px; }
.hero-area {
position: relative;
z-index: 0;
background-color: #edf1f4;
padding: 5px; }
.hero-area .hero-single-section {
position: relative;
z-index: 0;
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
width: 50%; }
@media only screen and (max-width: 767px) {
.hero-area .hero-single-section {
-webkit-box-flex: 0;
-ms-flex: 0 0 100%;
flex: 0 0 100%;
max-width: 100%;
width: 100%; } }
.hero-area .item1 {
height: 700px;
margin: 5px; }
@media only screen and (min-width: 992px) and (max-width: 1199px) {
.hero-area .item1 {
height: 600px; } }
@media only screen and (min-width: 768px) and (max-width: 991px) {
.hero-area .item1 {
height: 500px; } }
@media only screen and (max-width: 767px) {
.hero-area .item1 {
height: 350px; } }
.hero-area .item2 {
height: 340px;
margin: 5px; }
@media only screen and (min-width: 992px) and (max-width: 1199px) {
.hero-area .item2 {
height: 290px; } }
@media only screen and (min-width: 768px) and (max-width: 991px) {
.hero-area .item2 {
height: 240px; } }
@media only screen and (max-width: 767px) {
.hero-area .item2 {
height: 200px; } }
.hero-area .item3 {
height: 350px;
-webkit-box-flex: 0;
-ms-flex: 0 0 calc(50% - 10px);
flex: 0 0 calc(50% - 10px);
max-width: calc(50% - 10px);
width: calc(50% - 10px);
margin: 5px; }
@media only screen and (min-width: 992px) and (max-width: 1199px) {
.hero-area .item3 {
height: 300px; } }
@media only screen and (min-width: 768px) and (max-width: 991px) {
.hero-area .item3 {
height: 250px; } }
@media only screen and (max-width: 767px) {
.hero-area .item3 {
height: 200px; } }
.hero-area .item4 {
height: 350px;
-webkit-box-flex: 0;
-ms-flex: 0 0 calc(50% - 10px);
flex: 0 0 calc(50% - 10px);
max-width: calc(50% - 10px);
width: calc(50% - 10px);
margin: 5px; }
@media only screen and (min-width: 992px) and (max-width: 1199px) {
.hero-area .item4 {
height: 300px; } }
@media only screen and (min-width: 768px) and (max-width: 991px) {
.hero-area .item4 {
height: 250px; } }
@media only screen and (max-width: 767px) {
.hero-area .item4 {
height: 200px; } }
.single-blog-post {
position: relative;
z-index: 1; }
.single-blog-post .blog-thumb {
position: relative;
z-index: 1; }
.single-blog-post .blog-thumb img {
width: 100%; }
.single-blog-post .blog-content .post-tag {
color: #a6a6a6;
text-transform: uppercase;
font-size: 12px;
display: block;
font-weight: 700;
margin-bottom: 5px; }
.single-blog-post .blog-content .post-tag:hover, .single-blog-post .blog-content .post-tag:focus {
color: #ff1662; }
/* Set font-size */
@media only screen and (max-width: 767px) {
.single-blog-post .blog-content .post-tag {
font-size: 10px; } }
.single-blog-post .blog-content .post-title {
font-weight: 600;
font-size: 30px;
display: block;
color: #282828;
margin-bottom: 10px; }
/* Align text */
@media only screen and (max-width: 767px) {
.single-blog-post .blog-content .post-title {
font-size: 16px; } }
.single-blog-post .blog-content .post-title:hover, .single-blog-post .blog-content .post-title:focus {
color: #ff1662; }
.single-blog-post .blog-content .post-meta {
display: -webkit-box;
display: -ms-flexbox;
display: flex; }
/* Set space between text elements*/
.single-blog-post .blog-content .post-meta a {
color: #ffffff;
margin-right: 15px;
font-size: 11px;
line-height: 1;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: end;
-ms-flex-align: end;
-ms-grid-row-align: flex-end;
align-items: flex-end; }
/* Set color and placement on text*/
@media only screen and (max-width: 767px) {
.single-blog-post .blog-content .post-meta a {
font-size: 8px;
margin-right: 5px; } }
.single-blog-post .blog-content .post-meta a img {
margin-right: 10px; }
.single-blog-post .blog-content .post-meta a:last-child {
margin-right: 0; }
.single-blog-post .blog-content .post-meta a:hover, .single-blog-post .blog-content .post-meta a:focus {
color: #ff1662; }
.single-blog-post.white .blog-content .post-title,
.single-blog-post.white .blog-content .post-tag,
.single-blog-post.white .blog-content .post-meta a {
color: #ffffff; }
.single-blog-post.white .blog-content .post-title:hover, .single-blog-post.white .blog-content .post-title:focus,
.single-blog-post.white .blog-content .post-tag:hover,
.single-blog-post.white .blog-content .post-tag:focus,
.single-blog-post.white .blog-content .post-meta a:hover,
.single-blog-post.white .blog-content .post-meta a:focus {
color: #008ebe; }
.single-blog-post.style2 .blog-content .post-title {
font-size: 24px; }
</style>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<div class="hero-area d-flex flex-wrap">
<div class="hero-single-section">
<!-- Single Welcome Post -->
<div class="single-welcome-post bg-img item1" style="background-image: url(http://vouzalis.dk/stack/1.jpg);">
<!-- Content -->
<a href="https://www.youtube.com/watch?v=0aNNYEUARAk" class="video-play-btn"><i class="fa fa-play"></i></a>
<!-- Content -->
<div class="welcome-post-content">
<!-- Single Blog Post -->
<div class="single-blog-post white">
<div class="blog-content">
<a href="#" class="post-tag">Featured</a>
<a href="#" class="post-title">Watch a tiny cat taking a bath</a>
<div class="post-meta">
<a href="#">Here is a text about the picture</a>
</div>
<button href="#" class="btn btn-success btn-center">Read More</button>
</div>
</div>
</div>
</div>
</div>
<div class="hero-single-section">
<!-- Single Welcome Post -->
<div class="single-welcome-post bg-img item2" style="background-image: url(http://vouzalis.dk/stack/2.jpg);">
<!-- Content -->
</div>
<div class="hero-second-section d-flex flex-wrap">
<!-- Single Welcome Post -->
<div class="single-welcome-post bg-img item3" style="background-image: url(http://vouzalis.dk/stack/3.jpg);">
<!-- Content -->
</div>
<!-- Single Welcome Post -->
<div class="single-welcome-post bg-img item4" style="background-image: url(http://vouzalis.dk/stack/4.jpg);">
<!-- Content -->
<div class="welcome-post-content">
<!-- Single Blog Post -->
</div>
</div>
</div>
</div>
</div>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>