Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Parallax scrolling to content using CSS

    • 0
    • 0
    • 0
    • 0
    • 2
    • 0
    • 0
    • 0
    • 2.25k
    Comment on it

    Scrolling effects will be easy now by using the parallax site, that will able to scroll the two section smoothly between the two content div. Here I used three div for setting the different images in the background. While the caption heading for displaying the heading, user can use the text to it. that will be float with their scroll. This effects add beauty to the content of the div.


    Below is simple line of code that will explained in a shortest way. Hope this code will be effective for all web developers

    Html Source Code:-

    <div class="bgimg-1">
    <div class="caption">
    <span class="border">SCROLL DOWN</span>
    </div>
    </div>
    <div style="color: #777;background-color:white;text-align:center;padding:50px 80px;text-align: justify;">
    <h3 style="text-align:center;">Parallax Demo</h3>
    <p>Parallax scrolling is a web site trend where the background content is moved at a different speed than the foreground content while scrolling. Nascetur per nec posuere turpis, lectus nec libero turpis nunc at, sed posuere mollis ullamcorper libero ante lectus, blandit pellentesque a, magna turpis est sapien duis blandit dignissim. Viverra interdum mi magna mi, morbi sociis. Condimentum dui ipsum consequat morbi, curabitur aliquam pede, nullam vitae eu placerat eget et vehicula. Varius quisque non molestie dolor, nunc nisl dapibus vestibulum at, sodales tincidunt mauris ullamcorper, dapibus pulvinar, in in neque risus odio. Accumsan fringilla vulputate at quibusdam sociis eleifend, aenean maecenas vulputate, non id vehicula lorem mattis, ratione interdum sociis ornare. Suscipit proin magna cras vel, non sit platea sit, maecenas ante augue etiam maecenas, porta porttitor placerat leo.</p>
    </div>
    
    
    <div class="bgimg-2">
    <div class="caption">
    <span class="border" style="background-color:transparent;font-size:25px;color: #f7f7f7;">LESS HEIGHT</span>
    </div>
    </div>
    
    
    <div style="position:relative;">
    <div style="color:#ddd;background-color:#282E34;text-align:center;padding:50px 80px;text-align: justify;">
    <p>Scroll up and down to really get the feeling of how Parallax Scrolling works.</p>
    </div>
    </div>
    
    <!DOCTYPE html>
    <html>
    <head>
    <div class="bgimg-3">
    <div class="caption">
    <span class="border" style="background-color:transparent;font-size:25px;color: #f7f7f7;">SCROLL UP</span>
    </div>
    </div>
    
    <div style="position:relative;">
    <div style="color:#ddd;background-color:#282E34;text-align:center;padding:50px 80px;text-align: justify;">
    <p>Scroll up and down to really get the feeling of how Parallax Scrolling works.</p>
    </div>
    </div>
    
    
    <div class="bgimg-3">
    <div class="caption">
    <span class="border">COOL!</span>
    </div>
    </div>
    </body>
    </html>

    CSS Code:-

    body, html {
      height: 100%;
      margin: 0;
      font: 400 15px/1.8 "Lato", sans-serif;
      color: #777;
    }
    
    .bgimg-1, .bgimg-2, .bgimg-3 {
      position: relative;
      opacity: 0.65;
      background-attachment: fixed;
      background-position: top;
      background-repeat: no-repeat;
      background-size: cover;
    
    }
    .bgimg-1 {
        background-image: url("http://assets.barcroftmedia.com.s3-website-eu-west-1.amazonaws.com/assets/images/recent-images-11.jpg");
        min-height: 100%;
    }
    .bgimg-2 {
        background-image: url("http://imgs.abduzeedo.com/files/best_week/130222/Snake-Photography-19.jpg");
        min-height: 400px;
    }
    .bgimg-3 {
        background-image: url("http://7606-presscdn-0-74.pagely.netdna-cdn.com/wp-content/uploads/2016/03/Dubai-Photos-Images-Oicture-Dubai-Landmarks-800x600.jpg");
        min-height: 400px;
    }
    
    .caption {
      position: absolute;
      left: 0;
      top: 50%;
      width: 100%;
      text-align: center;
      color: #000;
    }
    
    .caption span.border {
      background-color: #111;
      color: #fff;
      padding: 18px;
      font-size: 25px;
      letter-spacing: 10px;
    }
    
    h3 {
      letter-spacing: 5px;
      text-transform: uppercase;
      font: 20px "Lato", sans-serif;
      color: #111;
    }

    NOTE:- Just copy and paste the above code to your text-editor this give give u result.

     

 2 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: