Skip to content
Advertisements

CSS Picture Gallery


HTML CODE:

<!DOCTYPE html>
<html>
<head>
    <title>page</title>
    <link rel="stylesheet" type="text/css" href="animation10.css">
</head>
<body>

    <section>
        <ul>
            <li>
                <a href="#">Image1</a>
                <img src="https://cn.pling.com/img/c/7/4/1/c5a5f92b530de2cf2c18e917c8a51ac60cb6.jpg">
            </li>
            <li>
                <a href="#">Image2</a>
                <img src=https://wallpaper.wiki/wp-content/uploads/2017/04/wallpaper.wiki-Images-wallpaper-new-PIC-WPC00923.jpg>
            </li>
            <li>
                <a href="#">Image3</a>
                <img src="https://cn.pling.com/img/5/e/6/9/c6b1bb16a588ed35f874726378b90b708ca3.jpg">
            </li>
            <li>
                <a href="#">Image4</a>
                <img src=http://www.ecoist.fi/wp-content/uploads/2018/07/great-wallpaper-hd-1.jpg>
            </li>
            <li>
                <a href="#">Image5</a>
                <img src=https://wallpapersite.com/images/wallpapers/house-4600x2828-landscape-forest-switzerland-4k-5356.jpg>
            </li>
        </ul>
    </section>
    
</body>
</html>

CSS CODE:

body{
  margin: 0;
  padding: 0;
  background-color: #000;
}
img{
  width: 1550px;
  height: 775px;
}
section{
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
ul{
  width: 100%;
  height: 50px;
  margin: 0;
  padding: 0;
  background:rgba(0,0,0,.2);
  box-sizing: border-box;
  display: flex;
}
ul li{
  list-style: none;
  width: 20%;
}
ul li a{
  display: block;
  text-align: center;
  line-height:50px;
  color:24px;
  text-decoration: none;
  cursor:pointer;
  color:#fff;
  font-family: arial;
  text-transform: uppercase;
  transition: .5s;
}
ul li a:hover{
  background-color: #fff;
  color: #000;
}
section img{
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  transition:0.5s;
  opacity: 0;
}
ul li:nth-child(1) a + img{
  opacity: 1
}
ul li a:hover + img{
  opacity: 1;
  animation: ani 30s linear infinite
}
@keyframes ani{
  0%{
    transform: scale(1);
  }
  100%{
    transform: scale(2);
  }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: