2017-07-04 109 views
-1

即时通讯在CSS中的初学者,我对此感到困惑2 ...谁能解释我背景附件有什么区别:固定和位置:固定?? ?背景附件之间的区别:固定和位置:固定

+0

那么它是什么? –

+0

发布了一个答案,希望你明白了吗? –

+0

为什么不在WEB上搜索'background-attachment:fixed'和'position:fixed',看看你能找到什么? –

回答

0

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
<style> 
 
body { 
 
    background-image: url('w3css.gif'); 
 
    background-repeat: no-repeat; 
 
    background-attachment: fixed; 
 
} 
 
p{ 
 
position: fixed; 
 
color:Red; 
 
} 
 
</style> 
 
</head> 
 
<body> 
 

 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 

 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>The background-image is fixed. Try to scroll down the page.</p> 
 
<p>If you do not see any scrollbars, try to resize the browser window.</p> 
 

 
</body> 
 
</html>

背景附件:固定是用于定位图片其中如,位置是:固定;适用于p,span,div等元素。

+0

我知道了...非常感谢你...))) –

+0

不客气:))对不起,我误解了第一个问题。这就是为什么我评论说这不是一个问题:( –

+0

不要担心兄弟: ) –