How to make the images not overlapping each other? - html

I want to place the flip cards onto the images so that when I hover over the flip card, the card will be flipped but the image will not be flipped. I am able to insert the flip cards on the images, but the images seem to be overlapping each other? Is there any ways to get rid of the overlapping of images? And also I would like to make the flip cards position at the center of the images.
.pic {height: 500px;
width: 400px;
opacity: 0.5;
float: left;}
.flipCard {background-color: transparent;
width: 300px;
height: 350px;
border: 3px solid black;
border-style: double;
perspective: 1000px;
float: left;}
.flipCardInner {position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.6s;
transform-style: preserve-3d;}
.flipCard:hover .flipCardInner {transform: rotateY(180deg);}
.flipCardFront, .flipCardBack {position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;}
.flipCardFront {background-color: pink;
color: rgba(255, 255, 255, 0.884);
font: 25px Imprint MT Shadow;
text-shadow: 2px 2px 4px black;}
.flipCardFront h1 {padding-top: 20px;}
.flipCardBack {background-color: rgba(30, 165, 255, 0.774);
color: white;
font: 18px Book Antiqua;
line-height: 1.5;
text-shadow: 1px 1px 3px black;
transform: rotateY(180deg);}
.flipCardBack p.headline {padding-top: 20px;}
<div class="flipCard">
<div>
<img src="april.jpg" class="pic">
</div>
<div class="flipCardInner">
<div class="flipCardFront">
<h1> April's <br> Pinky </h1>
</div>
<div class="flipCardBack">
<p class="headline"> It's not April's Fool, <br> but it's April's Pinky! </p>
<p> Just need to wear PINK costume <br> to enjoy special discount <br> in Fine Dinner course! </p>
</div>
</div>
</div>
<div class="flipCard">
<div>
<img src="wine.jpg" class="pic">
</div>
<div class="flipCardInner">
<div class="flipCardFront">
<h1> Be a <br> Sommelier </h1>
</div>
<div class="flipCardBack">
<p class="headline"> Do you love wine? </p>
<p> It's the opportunity for you <br> to taste our wine for FREE <br> when you spend above RM 800. </p>
</div>
</div>
</div>
<div class="flipCard">
<div>
<img src="hightea.jpg" class="pic">
</div>
<div class="flipCardInner">
<div class="flipCardFront">
<h1> Savoury <br> Treats </h1>
</div>
<div class="flipCardBack">
<p class="headline"> Are you a <br> high tea craver? </p>
<p> You just need to pay for ONE <br> when two persons come for our <br> High Tea course. </p>
</div>
</div>
</div>
<div class="flipCard">
<div>
<img src="giveaway.jpg" class="pic">
</div>
<div class="flipCardInner">
<div class="flipCardFront">
<h1> SNS <br> Giveaway </h1>
</div>
<div class="flipCardBack">
<p class="headline"> Everyone loves giveaways! <br> Who doesn't? </p>
<p> Visit our social media pages now <br> to participate in the <br> giveaway contest! </p>
</div>
</div>
</div>
<div class="flipCard">
<div>
<img src="hightea2.jpg" class="pic">
</div>
<div class="flipCardInner">
<div class="flipCardFront">
<h1> TGIF <br> Promo </h1>
</div>
<div class="flipCardBack">
<p class="headline"> Thanks God, <br> It's Friday! </p>
<p> Every Friday evening, <br> we will be featuring a <br> 20% discount on all items. </p>
</div>
</div>
</div>

Related

How do you center an image float? Also its text at the bottom

I already centered the images inside the "main-content" class, but I don't know if I do it right. And the second thing that I want to do is to center also the text, but if I use margin it also affects the images. Sorry for my confusing code, I'm just only a beginner.
Here is the HTML5 markup:
<main class="main-content">
<div class="item">
<a href="Products/groceries-pets/Fruits-Package.html">
<img
src="./Images/Products/groceries-pets/fruits-package.jpg"
class="img-content"
/>
</a>
<br />
<div>
<p href="Products/groceries-pets/Fruits-Package.html" class="desc">
<strong>Fruit Package</strong> <em> P1200 </em>
</p>
</div>
</div>
<div class="item">
<a href="products/home-living/Indoor-Plant.html">
<img
src="./Images/products/home-living/indoor-plant.jpg"
class="img-content"
/>
</a>
<br />
<div>
<p href="products/home-living/Indoor-Plant.html" class="desc">
<strong> Indoor Plant </strong> <em> P300 </em>
</p>
</div>
</div>
<div class="item">
<a href="Products/babies-toys/Baby-Cars.html">
<img
src="./Images/Products/babies-toys/baby-cars.jpg"
class="img-content"
/>
</a>
<br />
<div>
<p href="Products/babies-toys/Baby-Cars.html" class="desc">
<strong> Baby Cars</strong> <em> P150 </em>
</p>
</div>
</div>
<div class="item">
<a href="Products/fashion/Black-Shirt.html">
<img
src="./Images/Products/fashion/black-shirt.jpg"
class="img-content"
/>
</a>
<br />
<div>
<p href="Products/fashion/Black-Shirt.html" class="desc">
<strong> Black Shirt</strong> <em> P400 </em>
</p>
</div>
</div>
</main>
Here is my CSS:
.main-content {
background-color: rgb(219, 95, 95);
height: 340px;
width: 95%;
margin: 140px auto 0;
text-align: center;
}
.item {
float: left;
}
.img-content {
width: 200px;
height: 200px;
padding: 10px;
margin: 30px -200px 0px 200px;
object-fit: cover;
}
.desc {
text-align: center;
}
Try removing the margin from .img-content so that it aligns to the text, then add a margin to .item instead:
.main-content {
background-color: rgb(219, 95, 95);
height: 340px;
width: 95%;
margin: 140px auto 0;
text-align: center;
}
.item {
float: left;
margin: 20px;
}
.img-content {
width: 200px;
height: 200px;
padding: 10px;
object-fit: cover;
background-color: green;
}
.desc {
text-align: center;
}
<main class="main-content">
<div class="item">
<a href="Products/groceries-pets/Fruits-Package.html">
<img src="./Images/Products/groceries-pets/fruits-package.jpg" class="img-content" />
</a>
<br />
<div>
<p href="Products/groceries-pets/Fruits-Package.html" class="desc">
<strong>Fruit Package</strong> <em> P1200 </em>
</p>
</div>
</div>
<div class="item">
<a href="products/home-living/Indoor-Plant.html">
<img src="./Images/products/home-living/indoor-plant.jpg" class="img-content" />
</a>
<br />
<div>
<p href="products/home-living/Indoor-Plant.html" class="desc">
<strong> Indoor Plant </strong> <em> P300 </em>
</p>
</div>
</div>
<div class="item">
<a href="Products/babies-toys/Baby-Cars.html">
<img src="./Images/Products/babies-toys/baby-cars.jpg" class="img-content" />
</a>
<br />
<div>
<p href="Products/babies-toys/Baby-Cars.html" class="desc">
<strong> Baby Cars</strong> <em> P150 </em>
</p>
</div>
</div>
<div class="item">
<a href="Products/fashion/Black-Shirt.html">
<img src="./Images/Products/fashion/black-shirt.jpg" class="img-content" />
</a>
<br />
<div>
<p href="Products/fashion/Black-Shirt.html" class="desc">
<strong> Black Shirt</strong> <em> P400 </em>
</p>
</div>
</div>
</main>
One of the Css properties is the display property.
This property will put the items you have horizontally.
If you want to place it vertically,
Add this property after display: flex; and flex-direction: column;.
Then use the properties justify-content: center; and align-items: center;
This property will center the item.

CSS - Align Content Below Fixed Navbar

I'm trying to learn responsive CSS but having difficulty with some basic css design. I've created a fixed navbar as you may be able to see in the code below. But the problem i'm facing is that i'm not able to properly align content below it. The content is getting overlapped by the navbar. Can you suggest an appropriate CSS fix and not a workaround like adding empty divs with fixed heights? Here is the code:
*{
box-sizing: border-box;
}
body{
margin:0px;
padding: 0px;
background-color: darkgrey;
}
.title-bar{
position:fixed;
margin-top:0px;
z-index: 100;
opacity: 1;
background-color:white;
width: 100%;
height: 100px;
border-bottom: solid 4px dodgerblue;
}
.page-container{
padding: 0px;
}
.menu-options{
list-style-type:none;
}
.menu-options li{
display: inline;
padding: 10px;
}
.menu-options li:hover{
background-color: deepskyblue;
}
.menu-options li a{
color: black;
text-decoration:none;
}
.clear20{
height: 40px;
clear: both;
}
.clear10{
height: 20px;
clear: both;
}
.display-bar-1{
background-color: deepskyblue;
height: 200px;
padding:40px;
position: relative;
}
html {
font-family: "Lucida Sans", sans-serif;
}
.caps {
text-transform: uppercase;
}
.register_button{
text-align:center;
padding-top:20px;
padding-bottom:10px;
width: 200px;
height: 70px;
border: solid 3px white;
font-style:bold;
font-size:14pt;
}
.register_button:hover{
background-color:navajowhite;
color: white;
cursor:pointer;
border-color: black;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="responsive.css" rel="stylesheet">
</head>
<body>
<div class="page-container">
<div class="title-bar">
<table width="100%">
<tr>
<td><h1> Multirater Surveys </h1></td>
<td>
<ul class="menu-options">
<li> Home </li>
<li> How It Works </li>
<li> Features </li>
<li> Surveys </li>
<li> Plans and Pricings </li>
<li> Webinars </li>
<li> Blog </li>
</ul>
</td>
</tr>
</table>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
</div>
<input type="text" class="caps"/>
<script>
window.onload = function(){
document.getElementById("register").onclick = function(){
window.location = "https://www.google.com";
}
}
</script>
</body>
</html>
`responsive.html`
The appropriate way is to add padding-top in your div, the same padding as the height of your fixed header.
I made a few changes to your responsive.css file and it worked out for me.
Here are the changes that I made:
in title-bar class
.title-bar{
position:fixed;
top: 0;
z-index: 100;
opacity: 1;
background-color:white;
width: 100%;
height: 100px;
border-bottom: solid 4px dodgerblue;
}
I changed margin-top:0px; to top: 0;
Why? To Set the top edge of the fixed positioned navbar to 0 below the top edge of its nearest positioned ancestor as told here
and in the display-bar-1
.display-bar-1{
background-color: deepskyblue;
height: 200px;
margin-top: 100px;
padding:40px;
position: relative;
}
I added margin-top: 100px;
Why? Your navbar had a height of 100px. So i gave a margin top of 100px to your display-bar-1 class.
Hope this resolves your issue.
Your navbar has a height of 100px. So you need to start with your divs 100px below.
Add to the first div after the navbar this:
style="top:100px;"
Then it should work. It would look like this:
<div class="display-bar-1" style="top:100px;">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
Other ways would be to create an own css class for the first div after the navbar. Then you could also work with
padding-top:100px;
or
margin-top:100px;
*{
box-sizing: border-box;
}
body{
margin:0px;
padding: 0px;
background-color: darkgrey;
}
.title-bar{
position:fixed;
margin-top:0px;
z-index: 100;
opacity: 1;
background-color:white;
width: 100%;
height: 100px;
border-bottom: solid 4px dodgerblue;
}
.page-container{
padding: 0px;
}
.menu-options{
list-style-type:none;
}
.menu-options li{
display: inline;
padding: 10px;
}
.menu-options li:hover{
background-color: deepskyblue;
}
.menu-options li a{
color: black;
text-decoration:none;
}
.clear20{
height: 40px;
clear: both;
}
.clear10{
height: 20px;
clear: both;
}
.display-bar-1{
background-color: deepskyblue;
height: 200px;
padding:40px;
position: relative;
}
html {
font-family: "Lucida Sans", sans-serif;
}
.caps {
text-transform: uppercase;
}
.register_button{
text-align:center;
padding-top:20px;
padding-bottom:10px;
width: 200px;
height: 70px;
border: solid 3px white;
font-style:bold;
font-size:14pt;
}
.register_button:hover{
background-color:navajowhite;
color: white;
cursor:pointer;
border-color: black;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link href="responsive.css" rel="stylesheet">
</head>
<body>
<div class="page-container">
<div class="title-bar">
<table width="100%">
<tr>
<td><h1> Multirater Surveys </h1></td>
<td>
<ul class="menu-options">
<li> Home </li>
<li> How It Works </li>
<li> Features </li>
<li> Surveys </li>
<li> Plans and Pricings </li>
<li> Webinars </li>
<li> Blog </li>
</ul>
</td>
</tr>
</table>
</div>
<div class="display-bar-1" style="top:100px;">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-1">
<div class="row">
<div class="" style="width:60%;float:left;font-style:bold;font-size:22pt;color:white;padding:10px;">
World Class Service <br>
More Than 100 Clients
</div>
<div class="" style="padding:15px;float:left;width:40%;">
<div class="register_button" id="register"> <a style="text-decoration:none;color:black;" href="#"> Register Now </a> </div>
</div>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
<div class="display-bar-2">
<div>
<h1> Some random block of texts </h1>
<p> Hello world how are you ? what is going on? </p>
</div>
</div>
</div>
<input type="text" class="caps"/>
<script>
window.onload = function(){
document.getElementById("register").onclick = function(){
window.location = "https://www.google.com";
}
}
</script>
</body>
</html>

How to style a table layout with divs

I'm trying to get the images on both of divs below to act as a left-column while the accompanying text acts as a right column, both in the same row.
Each row should have the other images and texts along with it. Somewhere in the shuffle, I've got my divs mixed up and they aren't working properly. I need the text to stay within the container on the right. What am I missing?
.toplinks {
width: 300px;
padding: 20px;
overflow: hidden;
}
.icon {
width: 30%;
float: left;
}
.hlbox {
width: 300px;
border: 1px solid;
border-radius: 9px 9px 9px 9px;
border-color: #999999;
background-image: url(http://ejgh.org/templates/ejgh/images/HLHeader.png), url(http://ejgh.org/templates/ejgh/images/healthyLifestyles_bottom.gif);
background-size: 100% auto;
background-repeat: no-repeat;
background-position: top, bottom;
padding: 100px 20px 25px;
overflow: hidden;
}
.HLrow {
display: block;
border: 1px solid;
border-color: green;
width: 100%;
}
.HLicon {
width: 30%;
border: 1px solid;
border-color: red;
display: table-cell;
float: left;
height: inherit;
}
.HLtext {
width: inherit;
border: 1px solid;
border-color: purple;
}
<div class="toplinks">
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/findphysicianicon.jpg" alt="Find a Physician Icon" /></div>
<div class="text">
<h3>Find a Physician</h3>
<hr />Let us help you pick a doctor that fits your needs</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/paymybillicon.jpg" alt="Pay my Bill Icon" /></div>
<div class="text">
<h3>Pay My Bill</h3>
<hr />Conveniently pay your EJGH bill</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/myejghicon.jpg" alt="myEJGH.Org Icon" /></div>
<div class="text">
<h3>My EJGH.Org</h3>
<hr />See your up-to-date medical information</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/edocicon.jpg" alt="eDoc icon" width="75" /></div>
<div class="text">
<h3>eDoc</h3>
<hr />$49 Doctor visits via smartphone or online</div>
</div>
<div class="rTableRow">
<div class="icon"><img src="http://ejgh.org/images/stories/homepage/mdportalicon.jpg" alt="" width="75" /></div>
<div class="text">
<h3>EJGH MD Portal</h3>
<hr />Physician login for portal access</div>
</div>
</div>
<p></p>
<!--Start HL Table-->
<div class="hlbox">
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_memberbutton.png" alt="Image of Apple and Weights for homepage" width="100%"/></div>
<div class="HLtext">
<h3>Become a Member</h3>
<hr />
<p>Join Healthy Lifestyles and enjoy the benefits of membership.</p>
</div>
</div>
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_communitybutton.png" alt="Image of elderly couple at hospital in New Orleans Louisiana" width="100%" /></div>
<div class="HLtext">
<h3>Community Events</h3>
<hr />
<p>Learn more about the classes, events, support groups, and health screenings we offer.</p>
</div>
</div>
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_tvbutton.png" alt="Image of Liz Delsa Healthy Lifestyles Host" width="100%" /></div>
<div class="HLtext">
<h3>Watch TV Segments</h3>
<hr />
<p>Watch Healthy Lifestyles TV segments as seen on WWL-TV.</p>
</div>
</div>
<div class="HLrow">
<div class="HLicon"><img src="http://ejgh.org/templates/ejgh/images/hl_magbutton.png" alt="Summer 2016 Healthy Lifestyles Cover" width="100%" /></div>
<div class="HLtext">
<h3>Read the Magazine</h3>
<hr />
<p>Read the latest Healthy Lifestyles Magazine as included in the Times-Picayune newspaper.</p>
</div>
<!--End HL Table-->
</div></div>
<!--End Box Div—>
Also, the boxes around the HLdiv can go away - I just was using those to try to get an eye for what's pulling where.
Thanks again.
If I understood correctly, all you have to do is add display: table-cell; to the HLtextclass.

Page with multiple columns, horizontal scrolling, no vertical scrolling

I'd like to build a web page that has multiple columns. Within each column there will be boxes containing text; each box will either fit in one column or go to the top of the next column. If there are more columns than fit on the page, there should be horizontal scrolling. There should be no vertical scrolling. Here's an image of what I'd like to achieve:
In the example, box "The title 7" wouldn't fit at the bottom of column 1, so started new column 2. And then when no more new boxes can fit in column 2, they start at the top of column 3.
What I've so far managed to achieve is all the boxes in one column, using this CSS:
.outer {
height: 500px;
overflow-x: scroll;
background: #fc8;
}
h1 {
font-size: 18px;
margin: 1px 0px 3px 0px;
color: #248;
}
p { font-size: 13px; margin: 2px 0px;}
.box {
background: #def;
padding: 3px 6px;
border: 2px solid #369;
margin: 3px 6px;
vertical-align: top;
width: 250px;
}
The boxes are in a div.outer and have this HTML:
<div class='outer'>
<div class='box'>
<h1>The title 1</h1>
<p>Some text here...</p>
</div>
...etc...
</div>
See JS Fiddle for example. Ideally I'd like a solution that's just HTML and CSS, no JavaScript.
You can make use of flexbox layout. The columns will wrap after it reaches the maximum height using flex-flow: column wrap. Make sure you look into the browser support for flexbox.
JSfiddle Demo
.outer {
height: 500px;
overflow: auto;
background: #fc8;
/* Added CSS */
display: flex;
flex-flow: column wrap;
}
h1 {
font-size: 18px;
margin: 1px 0px 3px 0px;
color: #248;
}
p {
font-size: 13px;
margin: 2px 0px;
}
.box {
background: #def;
padding: 3px 6px;
border: 2px solid #369;
margin: 3px 6px;
vertical-align: top;
width: 250px;
}
<div class='outer'>
<div class='box'>
<h1>The title 1</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 2</h1>
<p>
Some different text here...
</p>
</div>
<div class='box'>
<h1>The title 3</h1>
<p>
Some longer text here. Danish croissant. Powder halvah. Tootsie roll topping tiramisu jelly-o fruitcake cheesecake marzipan.
</p>
</div>
<div class='box'>
<h1>The title 4</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 5</h1>
<p>
Some text here. Chocolate cake gummi bears wafer apple pie. Bear claw gummies pie sugar plum jujubes. Liquorice croissant sugar plum danish macaroon.
</p>
</div>
<div class='box'>
<h1>The title 6</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 7</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 8</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 9</h1>
<p>
Some varied text here...
</p>
</div>
<div class='box'>
<h1>The title 10</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 11</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
<div class='box'>
<h1>The title 12</h1>
<p>
Some text here...
</p>
</div>
</div>
You can achieve similar structure using CSS3 column property.
.outer {
height: 500px;
overflow: auto;
background: #fc8;
-webkit-columns: 3;
-moz-columns:3;
columns:3;
-webkit-column-width:250px;
-moz-column-width:250px;
column-width:250px;
-webkit-column-gap:10px;
-moz-column-gap:10px;
column-gap:10px;
}
DEMO

CSS Div Element with Inline-Block doesn't work

When using two div elements and the inline-block the two div's do not stand beside one another.
This is the code. (I configured some of the paragraphs and images to work better. I made sure the result was the same first though.)
<head>
<style>
#line {
display:inline-block;
margin-left:5%;
margin-right:75%;
border: 5px solid orange;
}
#TEST {
width:100%;
}
#pTxt {
text-align:center;
}
#heading {
color: red;
}
</style>
</head>
<body>
<div id="line">
<div>
<img id="TEST" alt="PICTURE" src="test.png" />
<div id="pTxt">
<h3 id="heading">
HEADING
</h3>
<p>TEST</p>
<br/>
<p>TEST</p>
</div>
</div>
</div>
<div id="line">
<img alt="PICTURE" id="TEST" src="test.png" />
<div id="pTxt">
<h3 id="heading">
HEADING
</h3>
<p>TEST</p>
<br/>
<p>TEST</p>
</div>
</div>
</body>
http://jsfiddle.net/gqfmmdy9/1/
Thanks in advance.
You are setting margin-right: 75%, which is pushing the next element to the bottom. You'll have to remove it.
Fiddle
#line {
display:inline-block;
margin-left:5%;
border: 5px solid orange;
}
#line {
display: inline-block;
margin-left: 5%;
border: 5px solid orange;
}
#TEST {
width: 100%;
}
#pTxt {
text-align: center;
}
#heading {
color: red;
}
<div id="line">
<div>
<img id="TEST" alt="PICTURE" src="test.png" />
<div id="pTxt">
<h3 id="heading">
HEADING
</h3>
<p>
TEST
</p>
<br/>
<p>
TEST
</p>
</div>
</div>
</div>
<div id="line">
<img alt="PICTURE" id="TEST" src="test.png" />
<div id="pTxt">
<h3 id="heading">
HEADING
</h3>
<p>
TEST
</p>
<br/>
<p>
TEST
</p>
</div>
</div>
#line {
display:inline-block;
margin-left:5%;
margin-right:75%;
border: 5px solid orange;
}
Your styles are working.
Try swapping margin-right:75%; for margin-right:2%;.
EDIT: Also, I suspect you need to give #line an explicit width declaration. Something like width:12%;.
If you want both the divs side by side, you can use <table> tag. See if this works for you.
<table>
<tr><td><div class="line">
<div>
<img class="TEST" alt="PICTURE" src="test.png"/>
<div class="pTxt">
<h3 class="heading">
HEADING
</h3>
<p>
TEST
</p>
<br/>
<p>
TEST
</p>
</div>
</div>
</div></td>
<td><div class="line">
<img alt="PICTURE" class="TEST" src="test.png"/>
<div class="pTxt">
<h3 class="heading">
HEADING
</h3>
<p>
TEST
</p>
<br/>
<p>
TEST
</p>
</div>
</div></td></tr>
</table>
and CSS
.line {
display:inline-block;
margin-left:5%;
margin-right:75%;
border: 5px solid orange;
}
.TEST {
width:100%;
}
.pTxt {
text-align:center;
}
.heading {
color: red;
}