Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
329 views
in Technique[技术] by (71.8m points)

html - Image is moving when I am scrolling the bar to the right

I have an image and when I go to the right this image is following me.I want to make it not move while I am scrolling on the right side.How to make this image not moving ?

 .img1 {
  top:9%;
 left:0%;
 height:67%;
 width:40%;
   position: fixed;

            background-image: url("https://img.freepik.com/free-photo/top-view-backgammon-game-board_68747-224.jpg?size=626&ext=jpg");
        }
 

the html code is this

<div class="img1">
 
 
 <div id='chess_board'>
 
   
</div>


</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

your problem is the feature of position: fixed;, simply, remove it or just give it a position other than fixed.

Also, for your background image not to be repeated, you could change your whole background-image property to background: url("https://img.freepik.com/free-photo/top-view-backgammon-game-board_68747-224.jpg?size=626&ext=jpg") no-repeat;.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...