• We just launched and are currently in beta. Join us as we build and grow the community.

Image Overlay Preloader using DIV in CSS

Musso

Anime Quizmaster
M Rep
0
0
0
Rep
0
M Vouches
0
0
0
Vouches
0
Posts
111
Likes
38
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
In this tutorial, we will create a Image Overlay Preloader Using DIV In CSS. It provides a friendly user interface using Bootstrap and CSS. We create a CSS snippet for displaying a preloader over div content. And its not only for the list of content, you can use it for every case where you want to overlay something on the content. Overlaying image on div is a most used featured. To fetch the content server takes some time and user does not understand what happening behind the scene. So, if you display a loading image over the content list, it will helpful for the user to understand the data loading process. See the example code below.

Sample Code

Index.html - is the html form for the design for the web page and for the content of the resources.

  1. <!DOCTYPE>
  2. <html

    >
  3. <head

    >
  4. <title

    >

    Image Overlay Preloader Using DIV In CSS</

    title

    >
  5. <link

    rel

    =

    "stylesheet"

    href

    =

    "css/style.css"

    >
  6. <link

    rel

    =

    "stylesheet"

    href

    =

    "bootstrap/css/bootstrap.min.css"

    >
  7. <script

    src

    =

    "js/jquery.min.js"

    ></

    script

    >
  8. <script

    src

    =

    "bootstrap/js/bootstrap.min.js"

    ></

    script

    >
  9. </

    head

    >
  10. <body

    >
  11. <nav class

    =

    "navbar navbar-inverse"

    >
  12. <div

    class

    =

    "container-fluid"

    >
  13. <ul

    class

    =

    "nav navbar-nav"

    >
  14. <li

    ><a

    href

    =

    "http://www.sourcecodester.com"

    ><b

    >

    Sourcecodester</

    b

    ></

    a

    ></

    li

    >
  15. <li

    class

    =

    "active"

    ><a

    href

    =

    "#"

    >

    HTML</

    a

    ></

    li

    >
  16. <li

    ><a

    href

    =

    "#"

    >

    CSS</

    a

    ></

    li

    >
  17. <li

    ><a

    href

    =

    "#"

    >

    JAVASCRIPT</

    a

    ></

    li

    >
  18. <li

    ><a

    href

    =

    "#"

    >

    PHP</

    a

    ></

    li

    >
  19. <li

    ><a

    href

    =

    "#"

    >

    SQL</

    a

    ></

    li

    >
  20. </

    ul

    >
  21. </

    div

    >
  22. </

    nav><br

    /

    ><br

    /

    ><br

    /

    ><br

    /

    >
  23. <div

    class

    =

    "container"

    align

    =

    "center"

    >
  24. <div

    class

    =

    "overlay"

    >
  25. <div

    class

    =

    "overlay-content"

    >
  26. <img

    src

    =

    "images/loading.gif"

    alt

    =

    "Loading..."

    /

    >
  27. </

    div

    >
  28. </

    div

    >
  29. <div

    class

    =

    "col-span"

    >
  30. <h4

    >

    You're Future Is Created By What You Do Today, Not Tomorrow.</

    h4

    >
  31. <img

    src

    =

    "images/img.jpg"

    class

    =

    "img-rounded"

    alt

    =

    "You're Future Is Created By What You Do Today, Not Tomorrow"

    width

    =

    "304"

    height

    =

    "236"

    >
  32. </

    div

    >
  33. <div

    class

    =

    "col-span"

    >
  34. <h4

    >

    Learn and Earn.</

    h4

    ><br

    >
  35. <img

    src

    =

    "images/img1.jpg"

    class

    =

    "img-circle"

    alt

    =

    "Learn and Earn"

    width

    =

    "304"

    height

    =

    "236"

    >
  36. </

    div

    >
  37. <div

    class

    =

    "col-span"

    >
  38. <h4

    >

    Men In The City.</

    h4

    ><br

    >
  39. <img

    src

    =

    "images/img2.jpg"

    class

    =

    "img-thumbnail"

    alt

    =

    "Men In The City"

    width

    =

    "304"

    height

    =

    "236"

    >
  40. </

    div

    >
  41. </

    div

    >
  42. </

    body

    >
  43. </

    html

    >

Style.css - And this script is for the loading/preloader of the images or for the content to think that the background content is in the process.

  1. .container{
  2. position

    :

    relative

    ;
  3. width

    :

    52%

    ;
  4. }
  5. .overlay{
  6. position

    :

    absolute

    ;
  7. left

    :

    0

    ;
  8. top

    :

    0

    ;

    right

    :

    0

    ;
  9. bottom

    :

    0

    ;
  10. z-index

    :

    2

    ;
  11. background-color

    :

    rgba

    (

    255

    ,

    255

    ,

    255

    ,

    0.8

    )

    ;
  12. }
  13. .overlay-content

    {
  14. position

    :

    absolute

    ;
  15. transform

    :

    translateY(

    -50%

    )

    ;
  16. -webkit-transform:

    translateY(

    -50%

    )

    ;
  17. -ms-transform:

    translateY(

    -50%

    )

    ;
  18. top

    :

    50%

    ;
  19. left

    :

    0

    ;
  20. right

    :

    0

    ;
  21. text-align

    :

    center

    ;
  22. color

    :

    #555

    ;
  23. }

Hope that you like my tutorial. And don't forget to Like and Share this to your friends. Enjoy Coding.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

449,193

322,229

322,238

Top