2013-07-30 36 views
3

我看過很多關於我的問題的帖子,沒有人真的擁有相同的html,所以我不能真正弄清楚。如何在不使內容透明的情況下使文章背景變爲半透明?

我試圖讓我的tumblr博客的帖子背景半透明,而不使照片,視頻,文字等在帖子上透明。現在我有

#left-column .post { 
    opacity: 0.5; 
    filter: alpha(opacity=50); 
    z-index: -1; 
    background: #fff; 
    border: 1px solid #ccc; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px; 
    float: left; 
    padding-top: 20px; 
    width: 520px; 
    } 

我相信我需要爲這個問題提供更多的代碼。如果您有任何要求,我會複製/粘貼到這裏。另外,我只知道html/css的基礎知識,所以如果我馬上就不明白,我會有一兩個問題。謝謝。

+0

檢查此鏈接可能是你它會幫助你, http://stackoverflow.com/questions/806000/css-半透明背景但不是文本?rq = 1 – user2582303

回答

2

使用的RGBA(紅,綠,藍阿爾法

background-color: rgba(255,255,255,0.5); 

所以,你的代碼將

#left-column .post { 
    z-index: -1; 
    background-color: rgba(255,255,255,0.5); 
    border: 1px solid #ccc; 
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px; 
    float: left; 
    padding-top: 20px; 
    width: 520px; 
} 
+0

我剛剛嘗試過,它對我沒有任何幫助。 – user2632633

+0

你能分享一個鏈接 – doitlikejustin

+0

到我的博客?哈哈我會叉我的HTML但不是我的博客 – user2632633

0

您可以使用本網站http://hex2rgba.devoth.com/,使你的背景,你需要如何如何透明是和什麼顏色

試試這個代碼:

#left-column .post { 
background: rgba(255, 255, 255, 0.5); 
border: 1px solid #ccc; 
border-radius: 5px; 
-moz-border-radius: 5px; 
-webkit-border-radius: 5px; 
float: left; 
padding-top: 20px; 
width: 520px; 
} 

RGBA(255,255,255,0.5)= #FFF

+0

謝謝,但這是幾乎其他人告訴我要做的事,它並不真正工作 – user2632633

+0

嘗試代碼我更新我的文章 –