Split a div into four separate divs - html

(source: kheper.net)
The effect I'm going for is the whole square being one div, with each square being a smaller div within the bigger div, correctly aligned, to take up the entire viewport.
Similar to montere.it minus the JavaScript.
I've tried to highlight the problematic bits of code, the corresponding CSS isn't formatting correctly but I've linked a JS bin below.
Apologies if my code is spaghetti code, it's less my code and more a copy and paste session gone wild.
#bodyHobbies {
width: 100%;
height: 500px;
}
.intbox1 {
height: 25%;
width: 100%;
background-color: #009900;
margin: auto;
text-align: center;
}
.intbox2 {
height: 25%;
width: 100%;
background-color: #990000;
margin: auto;
text-align: center;
color: #FFFFFF;
}
.intbox3 {
height: 25%;
width: 100%;
background-color: #000000;
margin: auto;
text-align: center;
color: #FFFFFF;
}
.intbox4 {
height: 25%;
width: 100%;
background-color: #990000;
margin: auto;
text-align: center;
color: #FFFFFF;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div id="bodyHobbies">
<div class="intbox1">
<p>1</p>
<img src="foobar1.jpg" border="0" />
</div>
<div class="intbox2">
<p>2</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox3">
<p>3</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox4">
<p>4</p>
<img src="foobar.jpg" border="0" />
</div>
</div>
https://jsbin.com/heyibe/edit?html,css,output

you can done that using css3 flexbox concept
html,body{
margin:0;
padding:0;
width:100%;
height:100%;
}
img{
width:100%;
}
#bodyHobbies{
display:flex;
flex-flow: row wrap;
}
.item{
flex-basis:50%;
}
<div id="bodyHobbies">
<div class="intbox1 item"><p>1</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
<div class="intbox2 item"><p>2</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
<div class="intbox3 item"><p>3</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
<div class="intbox4 item"><p>4</p>
<img src="https://i.stack.imgur.com/GSqmw.jpg" border="0" />
</div>
</div>

Just added display: inline-table to you #bodyHobbies and added a common class to the intbox divs. Removed the individual intbox stylings related to width and heights.
#bodyHobbies {
width: 100%;
height: 500px;
display: inline-table;
}
.intbox {
width: 50%;
height: 50%;
display: inline-block;
}
.intbox img {
width: 100%;
}
.intbox1 {
background-color:#009900;
margin:auto;
text-align:center;
}
.intbox2 {
background-color:#990000;
margin:auto;
text-align:center;
color:#FFFFFF;
}
.intbox3 {
background-color:#000000;
margin:auto;
text-align:center;
color:#FFFFFF;
}
.intbox4 {
background-color:#933230;
margin:auto;
text-align:center;
color:#FFFFFF;
}
<div id="bodyHobbies">
<div class="intbox intbox1"><p>1</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
<div class="intbox intbox2"><p>2</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
<div class="intbox intbox3"><p>3</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
<div class="intbox intbox4"><p>4</p>
<img src="http://lorempixel.com/900/700/sports/1/" border="0" />
</div>
</div>

Try this
<div id="bodyHobbies">
<div class="intbox1"><p>1</p>
<img src="foobar1.jpg" border="0" />
</div>
<div class="intbox2"><p>2</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox3"><p>3</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="intbox4"><p>4</p>
<img src="foobar.jpg" border="0" />
</div>
CSS
#bodyHobbies div{
float: left;
width: 50%;
}

<div id="bodyHobbies">
<div class="box">
<p>1</p>
<img src="foobar1.jpg" border="0" />
</div>
<div class="box">
<p>2</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="box">
<p>3</p>
<img src="foobar.jpg" border="0" />
</div>
<div class="box">
<p>4</p>
<img src="foobar.jpg" border="0" />
</div>
</div>
<style>
.box{width:calc(50% - 2px); margin:2px; float:left; min-height:100px;}
</style>

At css use vw, vh units to set body, parent element width, height to 100vw, 100vh. Set [class=^"int"] selector position to absolute. Set element left and top properties corresponding to the four positions within the viewport using :nth-of-type() pseudo class. left:0vw, top:0vh; left:50vw, top:0vh; left:0vw, top:50vh, left:50vw, top:50vh.
body {
width: 100vw;
height: 100vh;
}
#bodyHobbies {
width: 100vw;
height: 100vh;
display: block;
position: relative;
border: 2px solid sienna;
}
[class^="int"] {
width: 50vw;
height: 50vh;
display: block;
position: absolute;
border: 2px solid gold;
}
[class^="int"]:nth-of-type(1) {
left: 0vw;
top: 0vw;
background: blue;
}
[class^="int"]:nth-of-type(2) {
left: 50vw;
top: 0vh;
background: green
}
[class^="int"]:nth-of-type(3) {
left: 0vw;
top: 50vh;
background: red;
}
[class^="int"]:nth-of-type(4) {
left: 50vw;
top: 50vh;
background: tan;
}
<div id="bodyHobbies">
<div class="intbox1">
<p>1</p>
<img src="foobar1.jpg" border="0" alt="foobar1" />
</div>
<div class="intbox2">
<p>2</p>
<img src="foobar.jpg" border="0" alt="foobar2" />
</div>
<div class="intbox3">
<p>3</p>
<img src="foobar.jpg" border="0" alt="foobar3" />
</div>
<div class="intbox4">
<p>4</p>
<img src="foobar.jpg" border="0" alt="foobar4" />
</div>
</div>
jsfiddle https://jsfiddle.net/69zkbjgw/

Related

How can I change size of my first and last container in css flexbox?

I'm learning CSS and I have a problem with CSS flexbox and grid.
I wanted to make a grid as shown above but I couldn't. The first and last containers are in different sizes and the others are the same.
Here is my code:
.second-section {
width: 80%;
margin: 10px auto;
display: flex;
flex-direction: row;
position: relative;
flex-wrap: wrap;
}
.category-devider {
width: 80%;
margin: 0 auto;
}
.category-devider p {
font-size: 16px;
}
.category-devider span {
font-size: 18px;
color: #757575;
}
.image-containers {
position: relative;
width: 45%;
margin: 50px auto;
height: 434px;
background-color: #494949;
display: block;
text-align: center;
}
.image-containers h3 {
font-size: 18px;
}
.second-section #img-container img {
height: 100%;
width: 100%;
object-fit: cover;
}
.img1 img {
height: 612px;
}
<div class="second-section">
<div class="image-containers img1">
<img src="/img/apple-watch.jpg" alt="Apple Watch" />
<h3>Rule ratio</h3>
<p>Product design</p>
</div>
<div class="image-containers img2">
<img src="/img/circle.jpg" alt="Situation" />
<h3>Situation</h3>
<p>Visual identity</p>
</div>
<div class="image-containers img3">
<img src="/img/cards.jpg" alt="Cards" />
<h3>Dry air</h3>
<p>User research</p>
</div>
<div class="image-containers img4">
<img src="/img/orange-phone.jpeg" alt="Phone" />
<h3>Vertical</h3>
<p>Product design</p>
</div>
<div class="image-containers img5">
<img src="/img/phone.jpg" alt="Phone" />
<h3>Variable compose</h3>
<p>Product design</p>
</div>
<div class="image-containers img6">
<img src="/img/phone1.jpg" alt="Phone" />
<h3>Scope shift</h3>
<p>Product design</p>
</div>
</div>
You can make array of objects:
{
name: 'name',
title: 'title',
text: 'text'
}
and write:
<div class="second-section">
{array.map((picture, index) => {
<div class={`image-containers img${index}`}>
<img src={`/img/${name}.jpg`} alt="Phone" />
<h3>{picture.title}</h3>
<p>{picture.text}</p>
</div>
})}
</div>

How can I put 2 different sized pictures side by side, so there height will be the same in HTML?

This is the css I have:
<style>
.column {
padding: 5px;
}
.row {
display: flex;
justify-content: center;
}
</style>
And this is the HTML code:
<div class="row">
<div class="column">
<img src="image1.jpg" alt="climbing a mountain" style="width: 100%;" />
</div>
<div class="column">
<img src="image2.jpg" alt="climbing a metal tree" style="width: 100%;" />
</div>
</div>
.column {
padding: 5px;
}
.row {
display: flex;
justify-content: center;
}
<div class="row">
<div class="column">
<img src="https://picsum.photos/200/300" alt="climbing a mountain" style="width: 100%;" />
</div>
<div class="column">
<img src="https://picsum.photos/200/300" alt="climbing a metal tree" style="width: 100%;" />
</div>
</div>
I have tried messing with the width and height options and it didn't work, but maybe I am missing something
Using flex and align-items: stretch; on .row along with height: 100% on the img works well for this:
<style>
.column {
padding: 5px;
border: 1px solid blue;
}
.column img {
height: 100%;
}
.row {
display: flex;
justify-content: center;
align-items: stretch;
border: 1px solid red;
}
</style>
<div class="row">
<div class="column">
<img src="https://picsum.photos/200" alt="climbing a mountain" style="width: 100%;" />
</div>
<div class="column">
<img src="https://picsum.photos/300" alt="climbing a metal tree" style="width: 100%;" />
</div>
</div>
I added borders for demonstration purposes.
You can do that by having width: 100%;height: 100% then defining some height(values must be absolute or in vh) values to img parent class
.column {
padding: 5px;
width: 40%;
height: 250px;
}
.row {
display: flex;
justify-content: center;
}
<div class="row">
<div class="column">
<img src="https://imgsv.imaging.nikon.com/lineup/coolpix/p/p7000/img/sample/img_02_b.jpg" alt="climbing a mountain" style="width: 100%;height:100%" />
</div>
<div class="column">
<img src="https://pixy.org/src/477/4774988.jpg" alt="climbing a metal tree" style="width: 100%;height:100%" />
</div>
</div>

I tried a floating div over an image but doesn't work

My Problem
I want to make text-box/a box over an image with div, i already tried this but why it can't.
My code goes here:
HTML/CSS :
.main{
position: relative;
margin: 8;
}
.main img{
position: relative;
height: 510px;
width: 100%;
}
.main-content{
position: absolute;
background: white;
height: 40px;
width: 40px;
}
<!DOCTYPE html>
<html>
<head>
<title>PokeMart</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<img src="valor.png">
<h3>PokeMart</h3>
<h4>Login</h4>
<h4>Register</h4>
</div>
<div class="main">
<img src="bg.jpg" />
<div class="main-content">Text</div>
</div>
<div class="footer">
<h5>Pokemart established 2017, powered by Pokemon Company</h5>
<h5>Copyright © 2017 LL. All Right Reserved.</h5>
<div class="contact">
<img src="facebook.png" width="25" height="25">
<img src="google.png" width="25" height="25">
<img src="twitter.png" width="25" height="25">
<img src="github.png" width="25" height="25">
<img src="instagram.png" width="25" height="25">
</div>
</div>
</body>
</html>`
CSS code just the floating div, I have tried Display: Inline-block still don't work.
You're using absolute positioning but not directing where the content should be placed. Try using top,left,right,bottom to adjust the content position.
top:20%;
right:100px;
.main {
position: relative;
margin: 8;
}
.main img {
position: relative;
height: 510px;
width: 100%;
}
.main-content {
position: absolute;
top: 20%;
right: 100px;
background: white;
height: 40px;
width: 40px;
}
<!DOCTYPE html>
<html>
<head>
<title>PokeMart</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="header">
<img src="valor.png">
<h3>PokeMart</h3>
<h4>Login</h4>
<h4>Register</h4>
</div>
<div class="main">
<img src="http://via.placeholder.com/9000x500" />
<div class="main-content">Text</div>
</div>
<div class="footer">
<h5>Pokemart established 2017, powered by Pokemon Company</h5>
<h5>Copyright © 2017 LL. All Right Reserved.</h5>
<div class="contact">
<img src="facebook.png" width="25" height="25">
<img src="google.png" width="25" height="25">
<img src="twitter.png" width="25" height="25">
<img src="github.png" width="25" height="25">
<img src="instagram.png" width="25" height="25">
</div>
</div>
</body>
</html>`
.wrap {
border: 1px solid #000;
position: relative;
max-width: 450px;
}
.wrap img {
border: 1px solid #000;
display: block;
width: 100%;
box-sizing: border-box;
}
.wrap .overlay {
border: 1px solid #000;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
}
.wrap .overlay .box {
margin: auto;
background-color: #FFF;
border: 1px solid #000;
padding: 40px;
}
<div class="wrap">
<img src="http://www.telegraph.co.uk/content/dam/gaming/2017/10/10/Pokemon-Halloween_trans_NvBQzQNjv4BqZPnXlBHEdt8AtjizIYNgmRSlK0RKxqt6w8JJghUtSuI.jpg?imwidth=450">
<div class="overlay">
<div class="box">box</div>
</div>
</div>

how to wrap div elements boxes with responsive

How to wrap div boxes into main div along with images with responsive.?
Am trying to achieve below layout.
When i use float:left the boxes are aligned perfect where as without it if i use display inline block the boxes are not aligned as shown below.
My jfiddle
.mywrapper {
margin: 0 auto;
min-width: 320px;
max-width: 905px;
background: yellow;
}
.firstblock {
margin-top: 60px;
margin-bottom: 60px;
background: red;
//background: #2b2b2b;
padding:30px;
width:auto;
height:auto;
}
.mainimage{
width: 190px;
height: 125px;
margin-left:2%;
float:left;
padding-right:30px;
}
.smallbox{
float: left;
width: 190px;
height: 110px;
background-color: green;
margin-right:10px;
}
.secondblock {
margin-bottom: 30px;
height: 215px;
background: aqua;
padding:30px;
}
<div class="mywrapper" id="myid">
Hello
<div class="firstblock">
<div >
<img class="mainimage" src="mainimg.JPG" border="0" />
</div>
<div>
<h2 class="title"><span>MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT</span></h2>
<div class="smallbox"><img class="pcspecimg" src="box1.JPG" alt="box1.JPG" border="0" /><span>box1</span><div>MY TEXT</div></div>
<div class="smallbox"><img class="pcspecimg" src="box2.JPG" alt="box2.JPG" border="0" /><span>box2</span><div>MY TEXT MY TEXT</div></div>
<div class="smallbox"><img class="pcspecimg" src="box3.JPG" alt="box3.JPG" border="0" /><span>box3</span><div>MY TEXT MY TEXT</div></div>
</div>
</div>
<div class="secondblock">
secondblock
</div>
</div>
I think you would like this
.mywrapper {
margin: 0 auto;
min-width: 320px;
max-width: 905px;
background: yellow;
}
.firstblock {
margin-top: 60px;
margin-bottom: 60px;
background: red;
//background: #2b2b2b;
padding:30px;
width:auto;
height:auto;
}
.left-div{
float:left;
width: 27%;
height: 125px;
margin-right:2%;
border: 1px solid;
}
.right-div{
float:right;
width:70%;
}
h2{
margin-top:0;
}
.clear{
clear:both;
}
img{
height:auto;
width:auto;
max-width:100%;
max-height:100%;
}
.pcspecimg {
border: 1px solid #fff;
float: left;
height: 40px;
margin-right: 3%;
width: 27%;
}
.small-wrap {
margin-bottom: 5px;
}
.smallbox {
background-color: green;
float: left;
height: 110px;
margin-right: 1.5%;
width: 32.3%;
padding:5px;
box-sizing: border-box;
}
.smallbox:last-child{
margin-right:0;
}
.secondblock {
margin-bottom: 30px;
height: 215px;
background: aqua;
padding:30px;
}
<div class="mywrapper" id="myid">
Hello
<div class="firstblock">
<div class="left-div">
<img class="mainimage" src="mainimg.JPG" border="0" />
</div>
<div class="right-div">
<h2 class="title">
<span>MY TEXT MY TEXT</span>
</h2>
<div class="smallbox">
<div class="small-wrap">
<div class="pcspecimg">
<img src="box1.JPG" alt="box1" border="0" />
</div>
<span>box1</span>
<div class="clear"></div>
</div>
<div>MY TEXT</div>
</div>
<div class="smallbox">
<div class="small-wrap">
<div class="pcspecimg">
<img src="box1.JPG" alt="box1" border="0" />
</div>
<span>box1</span>
<div class="clear"></div>
</div>
<div>MY TEXT</div>
</div>
<div class="smallbox">
<div class="small-wrap">
<div class="pcspecimg">
<img src="box1.JPG" alt="box1" border="0" />
</div>
<span>box1</span>
<div class="clear"></div>
</div>
<div>MY TEXT</div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="secondblock">
secondblock
</div>
</div>
.mywrapper {
margin: 0 auto;
min-width: 320px;
max-width: 905px;
background: yellow;
}
.firstblock {
display: flex;
flex-direction: row;
margin-top: 60px;
margin-bottom: 60px;
background: red;
//background: #2b2b2b;
padding:30px;
width:auto;
height:auto;
}
.mainimage{
width: 190px;
height: 125px;
margin-left:2%;
float:left;
padding-right:30px;
}
.smallbox{
float: left;
width: 190px;
height: 110px;
background-color: green;
margin-right:10px;
}
.secondblock {
margin-bottom: 30px;
height: 215px;
background: aqua;
padding:30px;
}
<div class="mywrapper" id="myid">
Hello
<div class="firstblock">
<div>
<img class="mainimage" src="mainimg.JPG" border="0" />
</div>
<div>
<h2 class="title"><span>MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT MY TEXT</span></h2>
<div class="smallbox"><img class="pcspecimg" src="box1.JPG" alt="box1.JPG" border="0" /> <span>box1</span><div>MY TEXT</div>
</div>
<div class="smallbox"><img class="pcspecimg" src="box2.JPG" alt="box2.JPG" border="0" /> <span>box2</span><div>MY TEXT MY TEXT</div>
</div>
<div class="smallbox"><img class="pcspecimg" src="box3.JPG" alt="box3.JPG" border="0" /> <span>box3</span><div>MY TEXT MY TEXT</div>
</div>
</div>
</div>
<div class="secondblock">
secondblock
</div>
</div>
Is it you want?
Can You explain detail?

How to align 4 images as 2*2 in HTML?

I have been trying to align four images that are to be displayed as the pic below. But I have been getting spaces after each row. How can I remove them?
Also is there a way that I can add a small thumbnail of the example image in the middle where all four images meet?
Along with this I am also trying to add captions over the images. Currently they are displayed below the images. How can I add them over the images?
<!DOCTYPE html>
<html>
<body alink="ff0000" bgcolor="ffffff" link="0000ff" text="000000" vlink="800080">
<div>
<div class="transbox" style="width: 50%; height=50%; float: left;">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" width="100%" />
<div style="position: relative; top:50%; left:45%; width:200px; height:25px">
<center>
<font color="Black" size="+2">Looking Into The Future</font>
</center>
</div>
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" width="100%" />
<div style=" text-align: center; vertical-align: middle;">
<center>
<font color="Black" size="+2">correct one</font>
</center>
</div>
</div>
</div>
<div>
<div class="transbox" style="width: 50%; height=50%; float: right;">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" width="100%" />
<div style="position: relative; top:50%; left:45%; width:200px; height:25px">
<center>
<font color="Black" size="+2">Looking Into The Future</font>
</center>
</div>
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" width="100%" />
<div style="position: relative; top:50%; left:45%; width:200px; height:25px">
<center>
<font color="Black" size="+2">Looking Into The Future</font>
</center>
</div>
</div>
</div>
</div></body>
</html>
JSFiddle link:
https://jsfiddle.net/8bL4qqr8/
body{
background-color:"ffffff";
}
.img-grid{
width: 50%;
float:left;
height:400px;
}
.img-grid img{
width :100%;
height:400px;
}
.caption{
display :none;
}
.img-grid:hover .caption{
text-align: center;
display:block;
background: #000;
color: #fff;
font-size:16px;
font-weight: bold;
margin-top: -100px;
padding: 10px;
}
<div class="transbox img-grid">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" />
<div class="caption">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox img-grid">
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" />
<div class="caption">
<p>Looking into the future</p>
</div>
</div>
<div class="transbox img-grid">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" />
<div class="caption">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox img-grid">
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" />
<div class="caption">
<p>Looking Into The Future</p>
</div>
</div>
You have a lot of deprecated stuff in your HTML. Don't use all this link, text stuff in your body. And not <center> or <font> otherwise. I made a simple snippet of the stuff your wanted with flexbox. I modified your code a bit. You can find browser support for flexbox here: http://caniuse.com/#search=flexbox
body {
margin: 0;
padding: 0;
background-color: #FFFFFF;
}
* {
box-sizing: border-box;
}
.wrapper {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
.transbox {
position: relative;
flex: 1 0 50%;
width: 50%;
margin: 0;
padding: 0;
}
.transbox .thumbnail {
display: block;
position: absolute;
width: 100px;
height: 75px;
}
.transbox:nth-of-type(1) .thumbnail {
bottom: 0;
right: 0;
}
.transbox:nth-of-type(2) .thumbnail {
bottom: 0;
left: 0;
}
.transbox:nth-of-type(3) .thumbnail {
top: 0;
right: 0;
}
.transbox:nth-of-type(4) .thumbnail {
top: 0;
left: 0;
}
.transbox img {
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
float: left;
margin: 0;
padding: 0;
border: 0;
}
.transbox .text {
position: absolute;
width: 100%;
text-align: center;
color: #FFFFFF;
}
<div class="wrapper">
<div class="transbox">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" />
<div class="thumbnail">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" />
</div>
<div class="text">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox">
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" />
<div class="thumbnail">
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" />
</div>
<div class="text">
<p>Looking into the future</p>
</div>
</div>
<div class="transbox">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" />
<div class="thumbnail">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" />
</div>
<div class="text">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox">
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" />
<div class="thumbnail">
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" />
</div>
<div class="text">
<p>Looking Into The Future</p>
</div>
</div>
</div>
Hope this is what you were looking for
<!DOCTYPE html>
<html >
<head>
<style type="text/css">
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
}
.item {
position: relative;
float: left;
border: 1px solid #333;
overflow: hidden;
width: 50%;
height: 50%
}
.item img {
max-width: 100%;
-moz-transition: all 0.3s;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.item:hover img {
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
h1 {
color: white;
margin: 0;
padding: 20px;
}
html, body { height: 100%; padding: 0; margin: 0; }
</style>
</head>
<body>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<div class="grow" style=" width: 40%; position: fixed; top: 50%; left: 50%; margin-top: -100px; margin-left: -10%;">
<div>
<img class=" align:center"; src="https://s14.postimg.org/6ufixiest/Logo.jpg" width="100%" />
</div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/IT-1.jpg" alt="pepsi">
<div class="item-overlay top"></div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/RealEstate1.jpg" alt="pepsi" >
<div class="item-overlay top"></div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/VentureCapital-1.jpg" alt="pepsi" >
<div class="item-overlay top"></div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/Construction-1.jpg" alt="pepsi" >
<div class="item-overlay top"></div>
</div>
<div style=" width: 20%; position: fixed; top: 25%; left: 25%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Construction/Interior Design - Build to Live
</h1>
</div>
</div>
<div style=" width: 20%; position: fixed; top: 25%; left: 75%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Real Estate - Buy and Sell Potential Properties
</h1>
</div>
</div>
<div style=" width: 20%; position: fixed; top: 75%; left: 25%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Information Technology - Handling Potential IT Projects
</h1>
</div>
</div>
<div style=" width: 20%; position: fixed; top: 75%; left: 75%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Venture Capital - Finance for High Growth Potential
</h1>
</div>
</div>
<div class="grow" style=" width: 20%; position: fixed; top: 50%; left: 50%; margin-top: -100px; margin-left: -10%;">
<div>
<img class=" align:center"; src="https://s14.postimg.org/6ufixiest/Logo.jpg" width="100%" />
</div>
</div>
</body>
</html>