Sunday, November 8, 2020

IMAGE GRID TUTORAL

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image Grid</title>
<style>
*{
box-sizing: border-box;
}
body{
margin: 0%;
background-color: black;
}
.header{
text-align: center;
padding: 32px;
color: rgb(119, 235, 119);
}
.row{
display: flex;
flex-wrap: wrap;
padding: 0px 4px;
height: 1000px;
width: 1000px;
margin-left: 270px;
}
.column{
flex: 50%;
padding: 0px 4px;
}
.column img{
margin-top: 8px;
vertical-align: middle;
width: 100%;
}
.btn{
background-color: orange;
width: 200px;
margin: 10px;
padding: 5px;
font-size: 20px;
border-radius: 10px;
outline: none;
cursor: pointer;
}
.btn:hover{
background-color: purple;
color: white;
}
</style>
</head>
<body>
<div class="header" id="myheader">
<h1>Sync Programming Image grid Tutorial</h1>
<p>Click on the below buttons to view different grids</p>
<button class="btn" onclick="one()">1</button>
<button class="btn" onclick="two()">2</button>
<button class="btn" onclick="three()">3</button>
<button class="btn" onclick="four()">4</button>
</div>
<div class="row">
<div class="column">
<img src="Images/hulk vs hulkbuster.jpg" alt="">
<img src="Images/background.png" alt="">
<img src="Images/beautiful image bg.jpg" alt="">
<img src="Images/dance2.jpg" alt="">
</div>
<div class="column">
<img src="Images/greek mythology.jpg" alt="">
<img src="Images/background.png" alt="">
<img src="Images/hulk vs hulkbuster.jpg image bg.jpg" alt="">
<img src="Images/dance2.jpg" alt="">
</div>
<div class="column">
<img src="Images/back5.jpg" alt="">
<img src="Images/light background.jpg" alt="">
<img src="Images/beautiful image bg.jpg" alt="">
<img src="Images/meteor js.jpg" alt="">
</div>
<div class="column">
<img src="Images/hulk vs hulkbuster.jpg" alt="">
<img src="Images/node js.png" alt="">
<img src="Images/node js.png" alt="">
<img src="Images/background.png" alt="">
</div>
</div>
<script>
var images = document.getElementsByClassName('column')
function one(){
Array.from(images).forEach(image=>{
image.style.flex = '100%'
})
}
function two(){
Array.from(images).forEach(image=>{
image.style.flex = '50%'
})
}
function three(){
Array.from(images).forEach(image=>{
image.style.flex = '33%'
})
}
function four(){
Array.from(images).forEach(image=>{
image.style.flex = '25%'
})
}
</script>
</body>
</html>

No comments:

Post a Comment