1
我只想傾斜背景圖像,但我已將其創建爲外部元素,所以現在整個外部元素都會傾斜而不是僅顯示圖像。我沒有經驗的網頁開發,所以任何幫助或建議表示讚賞。下面的代碼片段,這裏是一個JSFiddle僅傾斜背景圖像
.vertical-center {
min-height: 100%;
/* Fallback for browsers do NOT support vh unit */
min-height: 100vh;
/* These two lines are counted as one :-) */
display: flex;
align-items: center;
}
.gallery-main {
background: url('http://www.diong.co.uk/laurentino/wp-content/themes/laurentinoazavedo/assets/img/poppy.png') 50% 0 no-repeat fixed;
-webkit-background-size: 30%;
-moz-background-size: 30%;
-o-background-size: 30%;
background-size: 30%;
/* height: 100vh;*/
text-align: center;
background-position: right;
background-color: #EDEAE3;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.gallery-main:hover {
-webkit-transform: rotate(-10deg);
-moz-transform: rotate(-10deg);
-o-transform: rotate(-10deg);
-ms-transform: rotate(-10deg);
}
.about-main {
background: url('http://www.diong.co.uk/laurentino/wp-content/themes/laurentinoazavedo/assets/img/orchid.png') 50% 0 no-repeat fixed;
-webkit-background-size: 30%;
-moz-background-size: 30%;
-o-background-size: 30%;
background-size: 30%;
/* height: 100vh; */
text-align: center;
background-position: left;
background-color: #EFEDE6;
-webkit-transition: all 0.5s ease;
-moz-transition: all 0.5s ease;
-o-transition: all 0.5s ease;
-ms-transition: all 0.5s ease;
transition: all 0.5s ease;
}
.about-main:hover {
-webkit-transform: rotate(10deg);
-moz-transform: rotate(10deg);
-o-transform: rotate(10deg);
-ms-transform: rotate(10deg);
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<a href="#">
<section class="gallery-main">
<div class="container-fluid vertical-center">
<div class="row">
<div class="col-sm-12 col-sm-offset-8">
<h2>GALLERY</h2>
<p>We create everlasting memories.</p>
</div>
<!-- end col -->
</div>
<!-- row -->
</div>
</section>
</a>
<a href="#">
<section class="about-main">
<div class="container-fluid vertical-center">
<div class="row">
<div class="col-sm-12 col-sm-offset-10">
<h2>ABOUT</h2>
<p class="larger-font">Working with natural wonders to illustrate the clean lines of modern design.</p>
</div>
<!-- end col -->
</div>
<!-- row -->
</div>
<!-- hero -->
</section>
</a>
這就是我一直纏鬥着,試圖找出如何在後臺分配給不同的標籤,或重新分配標籤只有花傾斜而不是整個部分標籤。 – Dino
查看上面的代碼示例。我將背景分配給了僞元素:before for your first section。你也可以在https://jsfiddle.net/p1fzvvuL/3/ –
上看到現場示例謝謝@Ihor,我將如何去做花的傾斜而不是整個背景。我不想看到背景的白色部分。 – Dino