欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

CSSbackground-image的小技巧

CSS background-image的小技巧?這個(gè)問題可能是我們?nèi)粘W(xué)習(xí)或工作經(jīng)常見到的。希望通過這個(gè)問題能讓你收獲頗深。下面是小編給大家?guī)淼膮⒖純?nèi)容,讓我們一起來看看吧!

創(chuàng)新互聯(lián)公司專注于江川企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站開發(fā),商城網(wǎng)站建設(shè)。江川網(wǎng)站建設(shè)公司,為江川等地區(qū)提供建站服務(wù)。全流程按需網(wǎng)站制作,專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)

1、將背景圖像完美適配視口

讓我們從比技巧更技巧的地方開始。 有多少次你不得不與你的背景圖像斗爭,以使其完美契合且又沒有拉伸感和吸引力的情況?

這里向你展示如何使你的背景圖片始終完全適合瀏覽器窗口!

CSS background-image的小技巧

css

body {
  background-image: url('https://images.unsplash.com/photo-1573480813647-552e9b7b5394?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2253&q=80');
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
  background-size: cover;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
}

事例源碼:https://codepen.io/duomly/pen/xxwYBOE

2、在CSS中使用多個(gè)背景圖片

嗯,如果我想在背景中添加一個(gè)以上的圖像怎么辦?

這是可能的,也不是很難,但是當(dāng)你有了將兩個(gè)圖形混合成美麗的東西的想法時(shí),可以得到一個(gè)不錯(cuò)的結(jié)果。

當(dāng)我們想要在背景圖像的頂部添加圖案時(shí),它是非常有用的,所以將在這個(gè)例子中向你展示這一點(diǎn)。

CSS background-image的小技巧

CSS3 中可以直接 指定多個(gè)背景路徑,如下所示:

body {
  background-image: url(https://image.flaticon.com/icons/svg/748/748122.svg), url(https://images.unsplash.com/photo-1478719059408-592965723cbc?ixlib=rb-1.2.1&auto=format&fit=crop&w=2212&q=80);
  background-position: center, top;
  background-repeat: repeat, no-repeat;
  background-size: contain, cover;
}

事例源碼:https://codepen.io/duomly/pen/eYpVoJR

3、創(chuàng)建三角背景圖像

另一個(gè)很酷的CSS背景圖片技巧是三角形背景圖片。它創(chuàng)造了非常漂亮的效果,尤其是當(dāng)我們想展示某些完全不同的選擇(例如白天和黑夜或冬天和夏天)時(shí)。

思路是這樣的,首先創(chuàng)建兩個(gè)div,然后將兩個(gè)背景都添加到其中,然后,第二個(gè)div使用clip-path屬性畫出三角形。

CSS background-image的小技巧

html

<body>
  <div class="day"></div>
  <div class="night"></div>
</body>

css

body {
  margin: 0;
  padding: 0;
}

div {
  position: absolute;
  height: 100vh;
  width: 100vw;
}

.day {
  background-image: url("https://images.unsplash.com/photo-1477959858617-67f85cf4f1df?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2613&q=80");
  background-size: cover;
  background-repeat: no-repeat;
}

.night {
  background-image: url("https://images.unsplash.com/photo-1493540447904-49763eecf55f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  background-size: cover;
  background-repeat: no-repeat;
  clip-path: polygon(100vw 0, 0% 0vh, 100vw 100vh);
}

事例源碼:https://codepen.io/duomly/pen/RwWQmwW

4、在背景圖像上添加疊加漸變

有時(shí)我們想在背景上添加一些文字,但有的圖片太亮,導(dǎo)致字看不清楚,所以這里我們就需要讓背景圖疊加一些暗樂來突出文字效果。

例如,可以通過添加粉紅橙色漸變或紅色至透明漸變來增強(qiáng)日落圖像,這些情況下使用疊加的漸變就很容易做到。

CSS background-image的小技巧

讓我們看看如何輕松地向背景圖像添加漸變疊加!

css

body {
  background-image: 
    linear-gradient(4deg, rgba(38,8,31,0.75) 30%, rgba(213,49,127,0.3) 45%, rgba(232,120,12,0.3) 100%),
    url("https://images.unsplash.com/photo-1503803548695-c2a7b4a5b875?ixlib=rb-1.2.1&auto=format&fit=crop&w=2250&q=80");
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center
}

事例源碼:https://codepen.io/duomly/pen/rNOJgQE

5、創(chuàng)建變色背景圖像動(dòng)畫

如果你能決定用哪種顏色作為背景圖片的覆蓋層會(huì)怎么樣?那么背景圖像上的動(dòng)畫是非常有用的。

使用一個(gè)動(dòng)畫疊加可以給你的網(wǎng)站一個(gè)偉大的最終效果,當(dāng)然,人們會(huì)記住它。

讓我們看看在CSS中使用背景圖像和動(dòng)畫可以做什么!

CSS background-image的小技巧

css

@keyframes background-overlay-animation {
  0%   {
      background-image: 
        linear-gradient(4deg, rgba(255,78,36,0.3) 50%, rgba(255,78,36,0.3) 100%), url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
  25%  {
      background-image: 
         linear-gradient(4deg, rgba(213,49,127,0.3) 50%, rgba(213,49,127,0.3) 100%), url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
  50%  {
    background-image: 
       linear-gradient(4deg, rgba(36,182,255,0.3) 50%, rgba(36,182,255,1) 100%),
     url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
  100% {
    background-image: 
        linear-gradient(4deg, rgba(0,255,254,0.3) 50%, rgba(0,255,254,0.3) 100%),
        url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
}

@-webkit-keyframes background-overlay-animation {
  0%   {
      background-image: 
        linear-gradient(4deg, rgba(255,78,36,0.3) 50%, rgba(255,78,36,0.3) 100%)
        url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
  25%  {
      background-image: 
         linear-gradient(4deg, rgba(213,49,127,0.3) 50%, rgba(213,49,127,0.3) 100%),
        url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
  50%  {
    background-image: 
       linear-gradient(4deg, rgba(36,182,255,0.3) 50%, rgba(36,182,255,1) 100%),
     url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
  100% {
    background-image: 
        linear-gradient(4deg, rgba(0,255,254,0.3) 50%, rgba(0,255,254,0.3) 100%),
        url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  }
}

body {
   background-image: url("https://images.unsplash.com/photo-1559310589-2673bfe16970?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80");
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-position: center;
  animation-name: background-overlay-animation;
  animation-duration: 5s;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    animation-timing-function: linear;
}

事例源碼:https://codepen.io/duomly/pen/gOavNOv

6、制作網(wǎng)格背景圖片

有時(shí)候會(huì)遇到一些需要有藝術(shù)或者攝影類的項(xiàng)目,他們一般要求網(wǎng)站要有藝術(shù)信息,要有創(chuàng)意。網(wǎng)絡(luò)的背景就挺有創(chuàng)意的,效果如下:

CSS background-image的小技巧

HTML

<body>
<div class="container">
  <div class="item_img"></div>
  <div class="item"></div>
  <div class="item_img"></div>
  <div class="item"></div>
  <div class="item"></div>
  <div class="item_img"></div>
  <div class="item"></div>
  <div class="item_img"></div>
  <div class="item"></div>
  <div class="item"></div>
  <div class="item_img"></div>
  <div class="item"></div>
  <div class="item_img"></div>
  <div class="item"></div>
  <div class="item_img"></div>
  <div class="item"></div>
</div>
</body>

scss

body {
 margin: 0;
  padding: 0;
}

.container {
  position: absolute;
  width: 100%;
  height: 100%;
  background: black;
  display: grid;
  grid-template-columns: 25fr 30fr 40fr 15fr;
  grid-template-rows: 20fr 45fr 5fr 30fr;
  grid-gap: 20px;
  .item_img {
    background-image: url('https://images.unsplash.com/photo-1499856871958-5b9627545d1a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2207&q=80');
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
  background-size: cover;
}
}

事例源碼:https://codepen.io/duomly/pen/MWaQNWb

7、將背景圖像設(shè)置為文本顏色

使用background-imagebackground-clip ,可以實(shí)現(xiàn)背景圖像對文字的優(yōu)美效果。 在某些情況下,它可能非常有用,尤其是當(dāng)我們想創(chuàng)建一個(gè)較大的文本標(biāo)題而又不如普通顏色那么枯燥的情況。

CSS background-image的小技巧

HTML

<body>
  <h2>Hello world!</h2>
</body>

CSS

body {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  text-align: center;
  min-height: 100vh;
  font-size: 120px;
  font-family:Arial, Helvetica, sans-serif;
}

h2 {
   background-image: url("https://images.unsplash.com/photo-1462275646964-a0e3386b89fa?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2600&q=80");
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

感謝各位的閱讀!看完上述內(nèi)容,你們對CSS background-image的小技巧大概了解了嗎?希望文章內(nèi)容對大家有所幫助。如果想了解更多相關(guān)文章內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

新聞標(biāo)題:CSSbackground-image的小技巧
URL標(biāo)題:http://aaarwkj.com/article18/ggphgp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動(dòng)態(tài)網(wǎng)站、網(wǎng)站策劃、Google、移動(dòng)網(wǎng)站建設(shè)、微信公眾號、營銷型網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營
亚洲精品欧美综合第四区| 亚洲精品福利一二三区| 青青草原在线视频观看| 播放欧美日韩特黄大片| 亚洲少妇插进去综合网| 国产女人高潮流白丝视频| 亚洲精品视频久久免费| 亚洲日本在线观看一区| 97视频在线观看观看| 国产a情人一区二区国产| 亚洲中文字幕一区二区人妻| 国产91黑丝在线视频| 日韩中文字幕乱码卡一| 日韩成人在线高清视频| 真实国产熟女一区二区三区| 蜜桃臀视频一区二区三区| 日本一区二区三区三州免费观看 | 中文字幕精品久久久人妻| 91薄丝激情在线播放| 欧美一区二区三区日韩精品 | 国产精品一久久香蕉产线看| 人妻中字幕出轨中文字幕| 亚洲国产精品一区二区成人| 久久国产福利一区二区| 免费观看在线视频午夜| 国产亚洲欧美另类网爆| 欧美特黄高清在线观看| 亚洲伊人av第一页在线观看| 国产精品一区二区麻豆本子| 国产午夜视频成人无遮挡| 午夜影院免费在线观看五分钟| 午夜国产激情福利网站| 我的极品小姨在线观看| 五月婷婷亚洲激情综合网| av黄色成人在线观看| 精品人妻一区二区三区mp4| 久久人体午夜激情视频| 免费看男人添女人无遮挡| 久久女同互慰一区二区三区| 丝袜在线美腿视频网站| 日韩精品欧美视频久久|