css gif code example

Example 1: css grid

.item-a {
  grid-area: header;
}
.item-b {
  grid-area: main;
}
.item-c {
  grid-area: sidebar;
}
.item-d {
  grid-area: footer;
}

.container {
  display: grid;
  grid-template-columns: 50px 50px 50px 50px;
  grid-template-rows: auto;
  grid-template-areas: 
    "header header header header"
    "main main . sidebar"
    "footer footer footer footer";
}

Example 2: css image sprites

/******************** How to use image sprites? ************************/
/* For this, you need to position the image so that only a segment of it 
is revealed. This technique also allows you to zoom in on parts of the 
image */

<html>
  <head>
    <meta charset="UTF-8" />
    <title> Title </title>
    <style>

      #window_1 {
        height: 120px;
        width: 117px;
        background: url("image_path") 0px 0px; /* coordinates of the upper left point: x = 0 and y = 0 */
      }

      #window_2 {
        height: 150px;
        width: 100px;
        background: url("image_path") -300px -200px; /* coordinates of the upper left point: x = -300 and y = -200 (we use negative numbers) */
      }

    </style>
  </head>
  <body>

    <div id="window_1"></div>
    <div id="window_2"></div>

  </body>
</html>

Tags:

Html Example