Reputation: 555
I am trying to have 2 divs side by side and when i tried to put them in they just fall under eachother. One div is creating a margin on its own to push the others down, how to I get them side-by-side?
HTML:
<div class="teams">
<div class="team1">
<img src="images/teams/prolific.png" style="height : 100%; width : 100%; position : relative; z-index : 1">
</div>
<p class="team_info">
nothing</br>
something
</p>
</div>
<div class="teams">
<div class="team2">
<img src="images/teams/victory.png" style="height : 100%; width : 100%; position : relative; z-index : 1">
</div>
<p class="team_info">
nothing</br>
something
</p>
</div>
Upvotes: 0
Views: 275
Reputation: 5108
I wrote a code for you.try this.just copy and paste.this will help to you.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<style type="text/css">
div.left{
width:500px;
height: 600px;
position: absolute;
left: 5%;
box-shadow: 1px 2px 1px black;
}
div.left img{
width: 100%;
height: 500px;
}
div.right{
width:500px;
height: 600px;
position: absolute;
right: 5%;
box-shadow: 1px 2px 1px black;
}
div.right img{
width: 100%;
height: 500px;
}
</style>
<body>
<div class="maindiv">
<div class="left">
<img src="https://i.ytimg.com/vi/QGiJFumHUPo/maxresdefault.jpg">
<p>your description</p>
</div>
<div class="right">
<img src="http://media1.santabanta.com/full1/Countries/Places/places-126a.jpg">
<p>your descripion</p>
</div>
</div>
</body>
</html>
Upvotes: 0
Reputation: 23
Add display: inline-block;
in parent class
.teams {display: inline-block; margin: 0; width: 250px;}
Upvotes: 0