html - How can I make a page with css,which the background image is cover , with scrolling and also responsive? -


i want make page,which scroll down ,the content div ,cover ground image.so put background image body , create 2 divs, works in big window size, when change size of window, , make smaller (to test responsive), there white gap between image , content div.

would please me remove it?

       <html>         <head>                 <meta charset="utf-8">                 <meta http-equiv="x-ua-compatible" content="ie=edge">                  <meta name="viewport" content="width=device-width, initial-scale=1">                 <title>first</title>                  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">                 <link href="css/first.css"  rel="stylesheet">          <style>          body{              background: url("https://kalamarie123.files.wordpress.com/2012/03/img_7815-2.jpg") no-repeat top center fixed;             background-size:100%;           }           </style>         </head>           <body>          <div class="cover"></div>         <div class="content">lorem ipsum dummy text of </div>             </body>         </html>    .cover{     height: 1232px;     width: 100%;     margin: 0;     padding: 0;     color: white;     text-align: center;  } .content{     width: 100%;     height: 100%;     background: gray;     margin: 0;     padding: 0; } 

you need make body , html go bottom of page:

body, html {     min-height: 100%; } 

and set background background-size: cover;: https://css-tricks.com/perfect-full-page-background-image/


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -