2014-09-03 96 views
0

即時通訊新和我讓this頁面,但我有2個問題。我不瓦納我backgroind重複和我的jQuery的切換不工作:(jquery切換沒有切換,爲什麼我的背景重複

這是我的代碼的一部分,我需要改變,使其工作有什麼

body { 
    background: url("http://dash.ga.co/assets/anna-bg.png"); 
    background-size: cover; 
    background-position: center; 
} 
.first { 
    background: #000; 
    background-image: url("http://buddies.koinup.com/group-637.png"); 
    background-size: cover; 
    background-position: center; 
    width: 200px; 
    height: 200px; 
    position: fixed; 
    top: 50%; 
    left: 50%; 
    margin-top: -100px; 
    margin-left: -100px; 
    border: 1px solid #000; 
    border-radius: 10px; 

} 
p { 
    color: rgba(255,255,255,1); 
    background: black; 
    background: linear-gradient(bottom, rgba(0,0,0,1), rgba(0,0,0,.4)); 
    background: -webkit-linear-gradient(bottom, rgba(0,0,0,1), rgba(0,0,0,.4)); 
    background: -moz-linear-gradient(bottom, rgba(0,0,0,1), rgba(0,0,0,.4)); 
    padding: 10px; 
    line-height: 28px; 
    text-align: justify; 
    position: absolute; 
    bottom: 0; 
    margin: 0; 
    padding: 3px 65px 3px 64px; 
    height: 30px; 
    border-radius: 0px 0px 8px 8px; 
    transition: height .5s; 
    -webkit-transition: height .5s; 
    -moz-transition: height .5s; 
} 

回答

2

有關背景:?

body { 
    background-repeat: no-repeat; 
} 

jQuery的:。您沒有導入庫中的代碼本身的工作原理更新的jsfiddle:http://jsfiddle.net/qun3fbz2/1/

+0

行動有關的jQuery的錯誤。但是我並不認爲我的背景只能在上面,我希望這個背景圖像能夠在整個頁面中。像這裏一個這裏https://dash.generalassemb.ly/dddd/build-your-own-personal-website – 2014-09-03 10:07:41

0

像這樣

background: url("http://dash.ga.co/assets/anna-bg.png"); 

background: url("http://dash.ga.co/assets/anna-bg.png") no-repeat; 

因爲,存在內Body.The div.first沒有元件絕對位置。所以身體需要更少的身高

這樣做,如果你想。

<body> 
    <div style="min-height:600px;display:block;"> 
    <div class="first"> 
+0

嗯仍然沒有填充整個頁面。我注意到,當我刪除<!DOCTYPE html> evrything是好的,但是當我添加它時,它開始混亂:/ – 2014-09-03 10:44:11

+0

如何在小提琴中沒有<!DOCTYPE html>? – 2014-09-03 11:06:56

+0

是的。但是我先在我的電腦上編寫代碼,然後我忘了寫<!DOCTYPE html>,它只用一個div 100 x 100:D開始。當我添加背景改變他的屬性的文檔:/ – 2014-09-03 13:18:53

0
body { 
    background: url(http://dash.ga.co/assets/anna-bg.png) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

這是身體的CSS需要如何將所有的東西好的:)

http://jsfiddle.net/PhilipScot/qun3fbz2/3/