Stretch div dependence of content - html

I want stretch box dependence of content, i'm using flexbox, but i can't to do. Below link my example
Parent div
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-content: stretch;
Child div
order: 0;
flex: 0 1 auto;
align-self: auto;
.slick-track {
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-content: stretch;
}
.slick-slide {
width: 150px;
margin: 10px;
order: 0;
flex: 0 1 auto;
align-self: auto;
}
.sliderItem {
overflow: hidden;
background: #2F2F2F;
color: #fff;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
cursor: pointer;
}
.sliderItemTitle {
font-size: 25px;
font-weight: bold;
padding: 20px 20px 0;
min-height: 84px;
}
.sliderItemText {
display: flex;
padding-top: 10px;
padding: 0px 20px;
min-height: 58px;
align-items: center;
}
.sliderItemLinkBox {
margin-bottom: 20px;
padding: 0 20px;
}
.sliderItemLink {
color: yellow;
text-transform: uppercase;
}
<div class="slick-track">
<div class="slick-slide">
<div>
<div class="sliderItem">
<div class="sliderItemImg">
<img src="https://via.placeholder.com/150" alt="">
</div>
<div class="sliderItemTitle">
<strong>Title 1</strong>
</div>
<div class="sliderItemText">
lorema dadad addadadad adadadadadasd
</div>
<div class="sliderItemLinkBox">
<div class="sliderItemLink">
click
</div>
</div>
</div>
</div>
</div>
<div class="slick-slide">
<div>
<div class="sliderItem">
<div class="sliderItemImg">
<img src="https://via.placeholder.com/150" alt="">
</div>
<div class="sliderItemTitle">
<strong>Title 2</strong>
</div>
<div class="sliderItemText">
Lorem
</div>
<div class="sliderItemLinkBox">
<div class="sliderItemLink">
click
</div>
</div>
</div>
</div>
</div>
<div class="slick-slide">
<div>
<div class="sliderItem">
<div class="sliderItemImg">
<img src="https://via.placeholder.com/150" alt="">
</div>
<div class="sliderItemTitle">
<strong>Title 3</strong>
</div>
<div class="sliderItemText">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta dolore ipsa at minus molestias, neque rerum, aut minima voluptatum, dolorem odit nesciunt aliquid ullam officia reiciendis, recusandae natus maxime beatae.
</div>
<div class="sliderItemLinkBox">
<div class="sliderItemLink">
click
</div>
</div>
</div>
</div>
</div>
</div>
https://jsfiddle.net/7qvo2tmk/5/

This can be accomplished using JS to loop through the elements and adjust the height based on the tallest element.
Working Example
let slides = document.querySelectorAll('.sliderItem')
function updateHeights() {
let tallestSlide = 0
for (i = 0; i < slides.length; i++) {
if (slides[i].clientHeight > tallestSlide) {
tallestSlide = slides[i].clientHeight
}
}
for (i = 0; i < slides.length; i++) {
slides[i].style.height = tallestSlide + 'px'
}
}
window.onresize = updateHeights
updateHeights()

You can try doing this.
What I did is that I remove the div that encloses the .sliderItem
and then add height to the .sliderItem of height:100%. so that it will occupy the height of its parent div .slick-slide.
.slick-track {
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-content: stretch;
}
.slick-slide {
width: 150px;
margin: 10px;
order: 0;
flex: 0 1 auto;
align-self: auto;
}
.sliderItem {
height: 100%;
overflow: hidden;
background: #2F2F2F;
color: #fff;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.75);
cursor: pointer;
}
.sliderItemTitle {
font-size: 25px;
font-weight: bold;
padding: 20px 20px 0;
min-height: 84px;
}
.sliderItemText {
display: flex;
padding-top: 10px;
padding: 0px 20px;
min-height: 58px;
align-items: center;
}
.sliderItemLinkBox {
margin-bottom: 20px;
padding: 0 20px;
}
.sliderItemLink {
color: yellow;
text-transform: uppercase;
}
<div class="slick-track">
<div class="slick-slide">
<div class="sliderItem">
<div class="sliderItemImg">
<img src="https://via.placeholder.com/150" alt="">
</div>
<div class="sliderItemTitle">
<strong>Title 1</strong>
</div>
<div class="sliderItemText">
lorema dadad addadadad adadadadadasd
</div>
<div class="sliderItemLinkBox">
<div class="sliderItemLink">
click
</div>
</div>
</div>
</div>
<div class="slick-slide">
<div class="sliderItem">
<div class="sliderItemImg">
<img src="https://via.placeholder.com/150" alt="">
</div>
<div class="sliderItemTitle">
<strong>Title 2</strong>
</div>
<div class="sliderItemText">
Lorem
</div>
<div class="sliderItemLinkBox">
<div class="sliderItemLink">
click
</div>
</div>
</div>
</div>
<div class="slick-slide">
<div class="sliderItem">
<div class="sliderItemImg">
<img src="https://via.placeholder.com/150" alt="">
</div>
<div class="sliderItemTitle">
<strong>Title 3</strong>
</div>
<div class="sliderItemText">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta dolore ipsa at minus molestias, neque rerum, aut minima voluptatum, dolorem odit nesciunt aliquid ullam officia reiciendis, recusandae natus maxime beatae.
</div>
<div class="sliderItemLinkBox">
<div class="sliderItemLink">
click
</div>
</div>
</div>
</div>
</div>
Hope this helps

Related

Can't align a flex box next to a table even though they are in the same div

I can't work out how to align one item to the right hand side another element, one is a table and the other is a flex box. I've made sure they are in a div together but I just cant get them to line up next to each other. I've tried using a grid but cannot get that to work correctly.
I'm trying to line up my main rail element to the right hand side of game modes and factions like a side bar.
I've made sure they are in a div together but I just cant get them to line up next to each other. I've tried using a grid but cannot get that to work correctly, the grid just moves elements off screen and I just cant work it out.
float right only moves it to the right of the end of the factions element
vertical align seemed to do nothing?
body {
background-color: #2f2f2f;
color: white;
}
.box {
border: solid;
}
.header-text {
font-family: 'Philosopher';
font-size: 35px;
}
.subheading-text {
font-family: 'Roboto';
font-size: 20px;
}
.sub-heading {
text-align: center;
font-family: 'Roboto';
font-size: 25px;
font-weight: bold;
}
.page-content :is(h4) .mw-headline {
font-family: 'Philosopher';
font-size: 35px;
border-bottom: solid 5px;
border-top: solid 5px;
padding-top: 20px;
padding-bottom: 20px;
width: 100%;
}
.subtext {
text-align: center;
font-family: 'Roboto';
font-size: 10px;
font-weight: bold;
}
.titles {
font-family: 'Philosopher', sans-serif;
font-size: 35px;
height: 2px;
text-align: center;
line-height: 0.5;
vertical-align: top right;
}
.main-rail {
display: inline-flex;
flex-flow: column wrap;
justify-content: right;
width: 20%;
}
.main-rail>div {
text-align: center;
border: solid;
}
<div class="box">
<div>
<div class="game-modes">
<table style="display:flex; justify-content:center;">
<tr>
<td><img src="./images/Border.png" alt=""></td>
</tr>
<tr>
<td class="titles">Game Modes</td>
</tr>
<tr>
<td><img src="./images/Border.png" alt=""></td>
</tr>
</table>
<p></p>
<div style="display:flex; flex-wrap:wrap; flex-direction:row; justify-content:center;">
<div style="flex-basis:96px"><img src="./images/Casual_Full_Size.webp" width="200px" height="179px" alt="">
<div class="sub-heading">CASUAL<br /></div>
</div>
<div style="flex-basis:96px"><img src="./images/Game_Mod_Ranked_200px.webp" width="200px" height="179px" alt="">
<div class="sub-heading">RANKED<br /></div>
</div>
<div style="flex-basis:96px"><img src="./images/Game_Mod_Custom_200px.webp" width="200px" height="179px" alt="">
<div class="sub-heading">CUSTOM<br /></div>
</div>
</div>
</div>
<div>
<div class="factions">
<table style="display:flex; justify-content:center;">
<tr>
<td><img src="./images/Border.png" alt=""></td>
</tr>
<tr>
<td class="titles">Factions</td>
</tr>
<tr>
<td><img src="./images/Border.png" alt=""></td>
</tr>
</table>
<p></p>
<div style="display:flex; flex-wrap:wrap; flex-direction:row; justify-content:center;">
<div style="flex-basis:96px"><img src="./images/Emblem_Vestige.webp" width="209px" height="209px" alt="">
<div class="sub-heading">VESTIGE<br /></div>
</div>
<div style="flex-basis:96px"><img src="./images/Emblem_Drakkorith.webp" width="209px" height="209px" alt="">
<div class="sub-heading">DRAKKORITH<br /></div>
</div>
<div style="flex-basis:96px"><img src="./images/Emblem_Ascended.webp" width="209px" height="209px" alt="">
<div class="sub-heading">ASCENDED<br /></div>
</div>
<div style="flex-basis:96px"><img src="./images/Emblem_Oblivion.webp" width="209px" height="209px" alt="">
<div class="sub-heading">OBLIVION<br /></div>
</div>
<div style="flex-basis:96px"><img src="./images/Emblem_Neutral.webp" width="209px" height="209px" alt="">
<div class="sub-heading">NEUTRAL
<div class="subtext"><br />(Not a playable Faction)</div>
</div>
</div>
</div>
<div>
<div class="main-rail">
<div><img src="./images/Site-background-dark.webp" alt=""></div>
<div>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Molestiae quos sapiente accusantium ipsam rem corporis aliquam quam temporibus voluptatibus id non labore maiores unde, illo earum facere, deleniti magnam reprehenderit?</div>
<div>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Molestiae quos sapiente accusantium ipsam rem corporis aliquam quam temporibus voluptatibus id non labore maiores unde, illo earum facere, deleniti magnam reprehenderit?</div>
</div>
</div>
</div>
</div>
</div>
</div>

How to use flexbox to get an image and text insid my border

I'm trying to recreate this but I'm stuck on getting the image and text to fit inside the innermost border. the final is supposed to have an outside border, an inside border, and a div that expands across the top. Then a picture that is 30% width of the top spanning div. Then text that is supposed to be width 70% of the top spanning div.
This is what I got so far HTML:
:root {
--winter-primary: #ffd110;
}
.outside-winter-border {
border: 2px solid var(--winter-primary);
margin: auto;
max-width: 1000px;
}
.insdie-winter-border {
border: 2px solid var(--winter-primary);
margin: 20px;
}
.wh {
background-color: var(--winter-primary);
padding: 30px;
}
.winter-image {
width: 30%;
float: left;
}
.wi {
width: 70%;
float: right;
}
<section class="winter">
<div class="outside-winter-border">
<div class="insdie-winter-border">
<div class="section-heading">
<div class="wh">
<h2>Winter</h2>
</div>
</div>
<div class="content-wrapper">
<div class="winter-image">
<div class="section-image">
<a href="winter.html">
<img src="assets/images/winter.jpg" alt="Winter Image">
</a>
</div>
</div>
<div class="wi">
<div class="section-content">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit dolore enim sequi dignissimos vel fugit reiciendis minus voluptatem nostrum, at repellat odio libero cum eveniet officiis, cumque veritatis, qui eaque.
</p>
</div>
</div>
</div>
</div>
</div>
</section>
The exact desired result is unclear. However, here is a version using flex that gets both the image and text within the border. Don't use float.
.outside-winter-border {
border: 2px solid var(--winter-primary);
margin: auto;
max-width: 1000px;
}
.insdie-winter-border {
border: 2px solid var(--winter-primary);
}
img {
height: 100%;
}
.wh {
display: inline-flex;
}
.insdie-winter-border {
display: flex;
align-items: center;
}
:root {
--winter-primary: #ffd110;
}
p {
margin-left: 1em;
}
.section-heading {
width: 100%;
background-color: var(--winter-primary);
text-align: center;
}
.section-heading>h2 {
margin: 0;
}
<section class="winter">
<div class="outside-winter-border">
<div class="section-heading">
<h2>Winter</h2>
</div>
<div class="insdie-winter-border">
<div class="wh">
<a href="winter.html">
<img src="https://dummyimage.com/125/000/fff" alt="Winter Image">
</a>
</div>
<div class="content-wrapper">
<div class="winter-image">
</div>
<div class="wi">
<div class="section-content">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit dolore enim sequi dignissimos vel fugit reiciendis minus voluptatem nostrum, at repellat odio libero cum eveniet officiis, cumque veritatis, qui eaque.
</p>
</div>
</div>
</div>
</div>
</div>
</section>
I think you can try this (insted of .winter-image and .wi ):
.content-wrapper {
display: flex;
}
.winter-image {
flex: 3;
}
.wi {
flex: 7;
}

make the text take up as much space as the picture in grid with

i'm working on a school project where im supposed to do a portfolio. im trying to make a grid with pictuers and information next to that picture about stuff i have worked on. I'm trying to get the textbox to be as big as the picture. I have tried jusing flexbox and a lot of other stuff but can't get it to work. is there someone who can help me?
*{
box-sizing: border-box;
}
body{
background-color: #f4f4f4;
padding: 20px;
font-family: Arial;
}
.container {
max-width: 1600px;
margin: 0 auto;
}
.row {
margin:8px-16px;
}
.row,
.row > .column {
padding:2px 0px;
}
.column {
float:left;
width:50%;
}
.row:after {
content:"";
display:table;
clear:both;
}
.content {
background-color: white;
padding: 10px;
}
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 600px) {
.column {
width:100%;
}
}
<div class="container">
<div class="row">
<div class="column">
<div class="content">
<h3>Hemsida 1</h3>
<p>Lorem ipsum.</p>
</div>
</div>
<div class="column">
<div class="content">
<img src="atleta1.jpg" style="width:100%">
</div>
</div>
</div>
<div class="row">
<div class="column">
<div class="content">
<img src="atleta1.jpg" style="width:100%">ยด
</div>
</div>
<div class="column">
<div class="content">
<h3>Hemsida 2</h3>
<p>Lorem ipsum.</p>
</div>
</div>
</div>
<div class="row">
<div class="column">
<div class="content">
<h3>Hemsida 2</h3>
<p>Lorem ipsum.</p>
</div>
</div>
<div class="column">
<div class="content">
<img src="atleta1.jpg" style="width:100%">
</div>
</div>
</div>
</div>
You have complicated the layout very much. How do you like this layout option?
Each line is divided into two parts of 50%.
A small bonus: with small screens, due to the Flexbox property order, the description block is located above the picture.
P.S. Of course, this is not the final option. You can continue to improve it
Result
* {
box-sizing: border-box;
}
body {
background-color: #f4f4f4;
padding: 20px;
font-family: Arial;
}
.container {
max-width: 1600px;
margin: 0 auto;
padding: 0;
list-style: none;
}
.item {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
;
padding: 10px;
background-color: white;
}
.item__desc {
flex-basis: 50%;
}
.item__pic {
flex-basis: 50%;
}
.item_img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 600px) {
.item {
flex-direction: column;
width: 100%;
}
.item__desc {
order: -1;
}
}
<ul class="container">
<li class="item">
<div class="item__desc">
<h3>Hemsida 1</h3>
<p>Lorem ipsum.</p>
</div>
<div class="item__pic">
<img class="item_img" src="https://picsum.photos/536/354"></div>
</li>
<li class="item">
<div class="item__pic">
<img class="item_img" src="https://picsum.photos/536/354">
</div>
<div class="item__desc">
<h3>Hemsida 2</h3>
<p>Lorem ipsum.</p>
</div>
</li>
<li class="item">
<div class="item__desc">
<h3>Hemsida 2</h3>
<p>Lorem ipsum.</p>
</div>
<div class="item__pic">
<img class="item_img" src="https://picsum.photos/536/354"></div>
</li>
</ul>
And same code on CodePen
will be enough for homework. Edit and improve codes
*{
margin: 0;
padding: 0;
box-sizing:border-box;
}
.box{
margin-bottom:20px;
background: #3498db;
height:500px;
}
.box-left{
width:50%;
float:left;
height:500px;
padding:50px;
}
.box-left h3{
margin-bottom: 15px;
}
.box-right{
width:50%;
float:right;
height:500px;
}
.box-right img{
width:100%;
height:100%;
}
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div class="box">
<div class="box-left">
<h3>Head</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consequuntur quas a velit. Aut nihil, modi nobis corporis eveniet ratione aperiam repellat maiores corrupti quidem ipsam animi officiis, fugit quasi rem!</p>
</div>
<div class="box-right">
<img src="https://i.ibb.co/S6PdtwP/69037904-2403297686584790-2753464427788369920-n.jpg" alt="">
</div>
</div>
<div class="box">
<div class="box-left">
<h3>Head</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Consequuntur quas a velit. Aut nihil, modi nobis corporis eveniet ratione aperiam repellat maiores corrupti quidem ipsam animi officiis, fugit quasi rem!</p>
</div>
<div class="box-right">
<img src="https://i.ibb.co/S6PdtwP/69037904-2403297686584790-2753464427788369920-n.jpg" alt="">
</div>
</div>
</body>
</html>
live demo
codepen live demo

Equally divide the div and center them

html code:
<body>
<div id="grid-main_content">
<div class="block ">
<div class="column column-1">
<p>Esse ingeniis instituendarum...</p>
</div>
</div>
<div class="block">
<div class="column column-2">
<p>Quis voluptate o comprehenderit non fugiat ullamco..</p>
</div>
<div class="column column-2">
<p>Irure an arbitror de appellat fugiat offendit,..</p>
</div>
<span class="clear-both"></span>
</div>
<div class="block">
<div class="column column-3">
<p>Cernantur est possumus,..</p>
</div>
<div class="column column-3">
<p>Multos quamquam deserunt ea minim sed consequat,..</p>
</div>
<div class="column column-3">
<p>Eiusmod illum mandaremus quo appellat...</p>
</div>
<span class="clear-both"></span>
</div>
<div class="block">
<div class="column column-4">
<p>Duis arbitror sed dolor sint...</p>
</div>
<div class="column column-4">
<p>Eram expetendis doctrina ut offendit ipsum et deserunt familiaritatem,..</p>
</div>
<div class="column column-4">
<p>Cupidatat aut elit appellat...</p>
</div>
<div class="column column-4">
<p>Eu irure summis...</p>
</div>
<span class="clear-both"></span>
</div>
</div>
</body>
css:
.block {
border: 1px solid black;
margin: 2px;
}
.column {
padding: 5px;
margin: 5px;
}
.column-1 {
background: lightblue;
width: 100%;
}
.column-2 {
background: lightgreen;
width: 48%;
float: left;
}
.column-3 {
background: yellow;
width: 32%;
float: left;
}
.column-4 {
background: red;
width: 23%;
float: left;
}
And it looks like this:
As you can see, all of the contents of each blocks are not equal in length and are not centered because I want the block (columns) to be responsive to the width. How can I equally divide them into column-1 having full width, column-2 having 1/2 of the width, column-3 having 1/3 of the width and column-4 with a width of 1/4 width? And be centered horizontally.
css:
body, html{
margin:0;
padding:2px;
}
*{
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
}
.block {
border: 1px solid black;
padding: 2px;
float:left;
width:100%;
}
.column {
padding: 5px;
}
.column-1 {
background: lightblue;
width: 100%;
}
.column-2 {
background: lightgreen;
width: 50%;
float: left;
}
.column-3 {
background: yellow;
width: 33.333%;
float: left;
}
.column-4 {
background: red;
width: 25%;
float: left;
}
js:
$(function(){
equalHeight();
});
$(window).resize(function(){
equalHeight();
});
function equalHeight(){
var maxHeight = 0;
$(".column-4").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$(".column-4").height(maxHeight);
$(".column-3").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$(".column-3").height(maxHeight);
$(".column-2").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$(".column-2").height(maxHeight);
}
find fiddle dmeo
flexbox can do that.
With just this:
.block {
display: flex;
}
.column {
flex:1;
}
Suppport is IE10 and up.
.block {
border: 1px solid black;
margin: 2px;
display: flex;
}
.column {
padding: 5px;
margin: 5px;
flex:1;
}
.column-1 {
background: lightblue;
}
.column-2 {
background: lightgreen;
}
.column-3 {
background: yellow;
}
.column-4 {
background: red;
}
<body>
<div id="grid-main_content">
<div class="block ">
<div class="column column-1">
<p>Esse ingeniis instituendarum...</p>
</div>
</div>
<div class="block">
<div class="column column-2">
<p>Quis voluptate o comprehenderit non fugiat ullamco..</p>
</div>
<div class="column column-2">
<p>Irure an arbitror de appellat fugiat offendit,..</p>
</div>
</div>
<div class="block">
<div class="column column-3">
<p>Cernantur est possumus,..</p>
</div>
<div class="column column-3">
<p>Multos quamquam deserunt ea minim sed consequat,..</p>
</div>
<div class="column column-3">
<p>Eiusmod illum mandaremus quo appellat...</p>
</div>
</div>
<div class="block">
<div class="column column-4">
<p>Duis arbitror sed dolor sint...</p>
</div>
<div class="column column-4">
<p>Eram expetendis doctrina ut offendit ipsum et deserunt familiaritatem,..</p>
</div>
<div class="column column-4">
<p>Cupidatat aut elit appellat...</p>
</div>
<div class="column column-4">
<p>Eu irure summis...</p>
</div>
</div>
</div>
</body>
Here's a fiddle http://jsfiddle.net/gx9hfeLq/1/ that helps you with setting equal widths. It uses border-box so you won't have your boxes bumping to the next line when you use exactly half (50%), third (33.3%) etc. The padding takes up space inside the boxes making them fit and stretch 100% across:
*{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

CSS - Bootstrap Auto padding?

I am trying to style a webpage using Bootstrap. Here is my code:
<div class="row">
<div class="table-row">
<div class="mycolumn" id="sidebar">
<div class="list-group">
<div class="list-group-item"><input type="text" class="form-control" /></div>
<div id="mainmenucontentdiv" class="list-group-item">
<div>
<a class="list-group-item" href="#">Temporibus sit</a>
<a class="list-group-item" href="#">Deserunt consequuntur</a>
<a class="list-group-item" href="#">magni nesciunt</a>
<a class="list-group-item" href="#">lorem bla </a>
</div>
</div>
</div>
</div>
<div id="contentarea" class="mycolumn">
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Libero molestiae ipsam fuga excepturi, ullam illum iste non culpa et beatae, aut, cupiditate vitae voluptatibus explicabo magni tempora impedit saepe inventore.</div>
</div>
</div>
</div>
CSS:
#sidebar{
background-color: red;
padding: 20px 0px 0px;
width: 250px;
}
.mycolumn{
display: table-cell;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 15px;
}
#mainmenucontentdiv {
overflow: hidden;
padding: 0;
}
.table-row{
display: table-row;
}
To better view the example, you may see it here: http://jsfiddle.net/pkctb8uc/
Why is that the content in #contentarea is pushed down? As you can see there is a big blank area at the top. How can I fix it?
because you use display: table-cell, to fix this just add "vertical-align: top" in .mycolumn
Edit css as follows ,
.mycolumn{
float: left;
position: relative;
display: table-cell;
padding-left: 15px;
padding-right: 15px;
padding-bottom: 3px;
padding-top: 16px;
width: 37%;
}