A free-flowing grid system (must be IE 8 compatible) - html

At the moment, I have a tabular-style grid system, using a combination of inline-block and width. I do need to clarify that the <div>s I'm using in the jsFiddle contain text, while in reality, they'll each contain a table with a varying number of rows.
The sections are of unequal heights with the height value being calculated by the content. I'm not using Bootstrap, and I don't intend to.
Here is a jsFiddle of what I currently have, along with a diagram here.
And here is what I'm trying to achieve with this code. I should note that I've already tried changing it to display:block in combination with float:left and I couldn't achieve my goal.
The idea is that I'm trying to eliminate the unnecessary whitespace where a section on one side may be three times taller than the opposite side.
Can anyone enlighten me as to how I could approach this?

Here is a solution, by wrapping your sections with an article(could be div), and give that article the display:table-cell instead of #content, plus some minor changes
* {
font-size: 16px;
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
}
body {
background: #efefef;
color: #555;
font-family: "Segoe UI", Tahoma, Verdana, Helvetica, Arial, sans-serif;
font-size: 1em;
line-height: 1.25;
}
h2 {
padding: 1.5em 0 0 0;
}
#content {
background: navy;
margin: auto;
height: 200px;
padding: 2em;
width: 70%;
display: table;
margin: auto;
width: 100%;
table-layout: fixed
}
.cell {
display: table-cell;
vertical-align: top;
width: 44% padding: 0 2%;
}
section {
background-color: lightblue;
margin: 5%;
padding: 5%
}
<main id="content">
<article class="cell">
<section>
<h2>Section 1</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</section>
<section>
<h2>Section 2</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</section>
<section>
<h2>Section 3</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras vel enim sed urna maximus viverra at et turpis. Nulla ut tortor ac erat consequat consectetur.Ut consectetur id massa convallis gravida. Nulla eget urna pharetra, pretium enim et, facilisis
est. Praesent sit amet erat nec ligula rhoncus semper non sed purus.</div>
</section>
</article>
<article class="cell">
<section>
<h2>Section 4</h2>
<div>Morbi ac fringilla mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis eu ex erat.</div>
</section>
<section>
<h2>Section 5</h2>
<div>Vestibulum eleifend est purus, sit amet cursus lorem rutrum vel. Etiam vel volutpat tellus. Maecenas vehicula convallis lobortis. Praesent quis lorem quis purus bibendum condimentum eu id arcu. In laoreet ut est nec fermentum.</div>
</section>
<section>
<h2>Section 6</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</section>
</article>
</main>
UPDATE
based on OP comments, here is a responsive solution to meet OP requirements:
* {
font-size: 16px;
margin: 0;
padding: 0;
box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
}
body {
background: #efefef;
color: #555;
font-family:"Segoe UI", Tahoma, Verdana, Helvetica, Arial, sans-serif;
font-size: 1em;
line-height: 1.25;
}
h2 {
padding: 1.5em 0 0 0;
}
#content {
background: navy;
margin: auto;
height: 200px;
padding: 2em;
width: 70%;
display: table;
margin: auto;
width: 100%;
table-layout:fixed
}
.cell {
display: table-cell;
vertical-align: top;
padding:0 2%;
}
section {
background-color:lightblue;
margin:5%;
padding:5%
}
#media (max-width:1920px) { /* this will go from 1920px to 1280px */
.cell {
width: 44%;
}
}
#media (max-width:1280px) { /* this will go from 1280px to 480px */
.cell {
width: 50%;
float:left;
}
}
#media (max-width:480px) { /* this will go from 480px to 0px */
.cell {
width:100%;
display:block
}
}
<main id="content">
<article class="cell">
<section>
<h2>Section 1</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</section>
<section>
<h2>Section 2</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</section>
<section>
<h2>Section 3</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras vel enim sed urna maximus viverra at et turpis. Nulla ut tortor ac erat consequat consectetur.Ut consectetur id massa convallis gravida. Nulla eget urna pharetra, pretium enim et, facilisis
est. Praesent sit amet erat nec ligula rhoncus semper non sed purus.</div>
</section>
</article>
<article class="cell">
<section>
<h2>Section 4</h2>
<div>Morbi ac fringilla mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis eu ex erat.</div>
</section>
<section>
<h2>Section 5</h2>
<div>Vestibulum eleifend est purus, sit amet cursus lorem rutrum vel. Etiam vel volutpat tellus. Maecenas vehicula convallis lobortis. Praesent quis lorem quis purus bibendum condimentum eu id arcu. In laoreet ut est nec fermentum.</div>
</section>
<section>
<h2>Section 6</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</section>
</article>
<article class="cell">
<section>
<h2>Section 7</h2>
<div>Morbi ac fringilla mi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis eu ex erat.</div>
</section>
<section>
<h2>Section 8</h2>
<div>Vestibulum eleifend est purus, sit amet cursus lorem rutrum vel. Etiam vel volutpat tellus. Maecenas vehicula convallis lobortis. Praesent quis lorem quis purus bibendum condimentum eu id arcu. In laoreet ut est nec fermentum.</div>
</section>
<section>
<h2>Section 9</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</section>
</article>
</main>

Related

HTML and CSS Flexbox

The following is the given html code and I am not allowed to alter it by any means
#exceriseHead {
font-family: Arial, Helvetica, sans-serif;
font-size: 50px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
body {
color: gainsboro;
text-align: center;
}
p {
color: black
}
.exEnumeration {
color: green;
}
#exceriseFooter {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
.contentcolumnContent {
display: flex;
}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Abgabeseite 3</title>
<link rel="stylesheet" href="cssaufgabe2.css">
<!-- TODO: Import der CSS Datei -->
</head>
<body>
<h1>Übungsblatt 4</h1>
<div id="exceriseHead">
Aufgabe 3
</div>
<div class="contentcolumnContent">
<div class="exercisePart">
<div class="exEnumeration">
<h1>a.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>b.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. <span class="code">Nam ut lacinia<br> elit. </span> Fusce dictum lorem purus, a ullamcorper dolor<br> dictum eu. Proin a sapien ut mauris egestas
fringilla eu eu<br> magna. Ut eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>c.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
</div>
<div id="exceriseFooter">
[Gruppenbezeichnung]
</div>
</body>
</html>
This is how it looks
This is how it should look like
Hi, I got an assignment to write a css sheet in order to make a given html page look like the image below. However I can't figure out, how to put the enumerations ( a.), b.)and c.)) in front of the text. I hope you can help me :(
The work is almost done: for the .exercisePart elements you need to set flex-grow and flex-shrink to 1. display: flex and align-items: center so the letter and the text can be side by side
A small gap to the outer flexbox container may improve readability.
#exceriseHead {
font-family: Arial, Helvetica, sans-serif;
font-size: 50px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
body {
color: gainsboro;
text-align: center;
}
p {
color: black
}
.exEnumeration {
color: green;
}
#exceriseFooter {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
border: 1px solid black;
background-color: greenyellow;
text-align: center;
color: black;
}
.contentcolumnContent {
display: flex;
gap: 1rem;
justify-content: space-between;
}
.exercisePart {
flex: 1 1 auto;
display: flex;
gap: .25rem;
align-items: center;
}
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Abgabeseite 3</title>
<link rel="stylesheet" href="cssaufgabe2.css">
<!-- TODO: Import der CSS Datei -->
</head>
<body>
<h1>Übungsblatt 4</h1>
<div id="exceriseHead">
Aufgabe 3
</div>
<div class="contentcolumnContent">
<div class="exercisePart">
<div class="exEnumeration">
<h1>a.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>b.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. <span class="code">Nam ut lacinia<br> elit. </span> Fusce dictum lorem purus, a ullamcorper dolor<br> dictum eu. Proin a sapien ut mauris egestas
fringilla eu eu<br> magna. Ut eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
<div class="exercisePart">
<div class="exEnumeration">
<h1>c.)</h1>
</div>
<div>
<!-- TODO: Beispieltext durch Aufgabentext ersetzen -->
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br> Aenean pellentesque aliquet imperdiet. Nam ut lacinia elit.<br> Fusce dictum lorem purus, a ullamcorper dolor dictum eu.<br> Proin a sapien ut mauris egestas fringilla eu eu magna. Ut<br> eu imperdiet leo, vel ultrices quam.</p>
</div>
</div>
</div>
<div id="exceriseFooter">
[Gruppenbezeichnung]
</div>
</body>
</html>
The .exerciseParts contain two <div>s, which by default have display: block, meaning they take all the width they can from their container, thus stacking vertically.
In order to change that, you can make the .exercisePart flexbox containers:
.exercisePart {
display: flex;
}
That way by default all their children will stack horizontally and try and take the right amount of space.

CSS not applying to footer <p> element [duplicate]

This question already has answers here:
CSS margin terror; Margin adds space outside parent element [duplicate]
(7 answers)
CSS Property Border-Color Not Working
(6 answers)
Closed 9 months ago.
I am having some trouble understanding why margin: 1rem is not applying to my footer element. When I modify the size, only the text content in the <p> for the article div and aside element are modified. There is no margin between the footer text and the background color on the top and bottom, only on the left and right. Could anyone tell me what's causing this? Thanks
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<style>
body {
background-color: pink;
}
section {
background-color: lightgray;
max-width: 1000px;
box-sizing: border-box;
}
.article {
background-color: lightyellow;
width: 70%;
float: left;
margin: 0;
}
aside {
background-color: lightgreen;
float: right;
float: none;
overflow: hidden;
margin: 0;
}
footer {
clear: both;
background-color: aqua;
display: block;
border: black 10px;
box-sizing: border-box;
}
p {
margin: 1rem;
}
</style>
</head>
<body>
<section>
<div class="article">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac
eleifend ex, vitae bibendum tortor. Sed rutrum, orci quis venenatis
congue, justo orci volutpat justo, semper vestibulum mauris est mattis
mi. Duis tincidunt enim congue elit egestas, ut ultrices purus
vulputate. Curabitur gravida tellus vel ornare convallis. Nunc
</p>
</div>
<aside>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor
aliquam massa. Pellentesque maximus tortor ac est ultricies, id
sodales ligula vehicula. Fusce dignissim risus ligula, a feugiat augue
</p>
</aside>
<footer>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam
malesuada dolor quis ante tempus, eget posuere massa egestas. Integer
feugiat tellus nibh. Vestibulum pellentesque quam eu hendrerit porta.
Suspendisse sagittis eros vitae urna convallis, sit amet venenati
</p>
</footer>
</section>
</body>
</html>
The margin is applied - your problem is just that you have declared a 10px border without declaring a border-style, so essentially it looks like the p-element's margin is overflowing, because there is an invisible border of 10px. Apply a border-style and you will see the margin:
body {
background-color: pink;
}
section {
background-color: lightgray;
max-width: 1000px;
box-sizing: border-box;
}
.article {
background-color: lightyellow;
width: 70%;
float: left;
margin: 0;
}
aside {
background-color: lightgreen;
float: right;
float: none;
overflow: hidden;
margin: 0;
}
footer {
background-color: aqua;
display: block;
border: black solid 10px;
box-sizing: border-box;
}
p {
margin: 1rem;
}
<section>
<div class="article">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac eleifend ex, vitae bibendum tortor. Sed rutrum, orci quis venenatis congue, justo orci volutpat justo, semper vestibulum mauris est mattis mi. Duis tincidunt enim congue elit egestas, ut ultrices
purus vulputate. Curabitur gravida tellus vel ornare convallis. Nunc
</p>
</div>
<aside>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor aliquam massa. Pellentesque maximus tortor ac est ultricies, id sodales ligula vehicula. Fusce dignissim risus ligula, a feugiat augue
</p>
</aside>
<footer>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam malesuada dolor quis ante tempus, eget posuere massa egestas. Integer feugiat tellus nibh. Vestibulum pellentesque quam eu hendrerit porta. Suspendisse sagittis eros vitae urna convallis,
sit amet venenati
</p>
</footer>
</section>
I believe that is margin collapse.
I can see the intent to set a black border on the parent element footer in the first place. But that probably isn't working, and border: black 10px solid; would do the trick. And the margin collapse would no longer occur in this case.
Please read following page to learn about the margin collapse.
What is Margin Collapse in CSS? And How to Avoid It
And, as the other answers pointed out, perhaps it is padding, not margin, that suits your purpose.
You need to give padding to footer
Changes I made
In BODY tag
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
IN FOOTER
padding: 2%;
You apply box-sizing then i think you like to use padding. I refactor your css a little bit.
body {
background-color: pink;
}
section {
background-color: lightgray;
max-width: 1000px;
box-sizing: border-box;
}
.article {
background-color: lightyellow;
width: 70%;
float: left;
margin: 0;
}
aside {
background-color: lightgreen;
float: right;
float: none;
overflow: hidden;
margin: 0;
}
footer {
background-color: aqua;
box-sizing: border-box;
padding: 10px;
}
p {
margin: 1rem;
}
<section>
<div class="article">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ac
eleifend ex, vitae bibendum tortor. Sed rutrum, orci quis venenatis
congue, justo orci volutpat justo, semper vestibulum mauris est mattis
mi. Duis tincidunt enim congue elit egestas, ut ultrices purus
vulputate. Curabitur gravida tellus vel ornare convallis. Nunc
</p>
</div>
<aside>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor
aliquam massa. Pellentesque maximus tortor ac est ultricies, id
sodales ligula vehicula. Fusce dignissim risus ligula, a feugiat augue
</p>
</aside>
<footer>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam
malesuada dolor quis ante tempus, eget posuere massa egestas. Integer
feugiat tellus nibh. Vestibulum pellentesque quam eu hendrerit porta.
Suspendisse sagittis eros vitae urna convallis, sit amet venenati
</p>
</footer>
</section>

how do i put the sections in a straight line?

I am having problems with the two sections i'm making. i want to make a notification section but my 3 articles are not how i want them to be. how do i make it so that the three articles and the aside are on the same line without overflowing?
problem
I just want them in a straight line like these
Example
h1{
margin-top: 80px;
}
article {
background-color: beige;
margin-bottom: 1em;
min-height: 300px;
}
article.text{
color: black;
background: white;
min-height: 300px;
}
article, h2{
padding-top: 1em;
}
main{
column-count: 3;
column-gap: 20px;
margin-top: 1em;
}
<main>
<h1>Welkom op Het bedrijf</h1>
<section>
<article>
<p>
Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.
</p>
</article>
<aside>
<article class="text">
<h2>Whats new?</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenas eget maximus sem, in volutpat est.
</p>
</article>
</aside>
</main>
Actually from your explanation and images I gather that you want to split your page into two different areas:
a multi column story container
a single column notification area
As opposed to the current three column main container you have now.
Without using Flexbox and CSS-grid I created a snippet with what I understand you want. I added some extra articles and background-colors to show the structure and commented the CSS where applicable...
Bonus: added some 'responsive' behaviour using both math and #media queries.
/* Generally accepted preferred rules */
html,body { box-sizing: border-box; width: 100%; max-width: 100%; height: 100% }
*::before,*::after, * { box-sizing: inherit }
/* remove some default HTML spacing (when required, use padding instead) */
body,h1,h2,h3,h4,h5,h6,p { margin: 0 }
/* define page structure */
.main { height: 100%; width: 100% } /* avoid using <main> */
/* mobile first, 1 column */
section { max-width: 67%; float: left; column-count: 1; column-gap: 1.25rem }
aside { max-width: calc(33% - 1.25rem); float: right } /* minus column-gap */
article { break-inside: avoid } /* keeps content in the same column */
/* some responsiveness */
#media (min-width: 961px) { section { column-count: 2 } }
#media (min-width: 1281px) { section { column-count: 3 } }
/*
responsive page padding (linear equation y = mx + b)
p1(320,32) p2(1920, 72) => 0.025x + 24
p3(320, 8) p4(1920,320) => 0.195x - 54.4
grow from 32px on a 320px viewport to 72px on a 1920px viewport
grow from 8px on a 320px viewport to 320px on a 1920px viewport
*/
.padded {
padding: calc( 2.5vh + 24px) calc(19.5vw - 54.4px)
}
/* eye-candy only */
header {
column-span: all; /* span full container */
padding: 1.25rem; /* equal to column-gap */
background-color: Black; Color: White;
}
h1 { line-height: 1.25rem }
h2,p { padding-bottom: .5em }
section>article { background-color: Beige }
aside>article { background-color: rgba(0,0,0,.1); color: Black }
article {
padding: 1.25rem; /* equal to column-gap */
margin-bottom: 0.5rem /* space between articles */
}
[outlines="1"] * { outline: 1px dotted }
<div class="main padded" outlines="0">
<section>
<header>
<h1>Welkom op Het bedrijf</h1>
</header>
<article>
<h2>Story 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
</article>
<article>
<h2>Story 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
</article>
<article>
<h2>Story 3</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
</article>
<article>
<h2>Story 4</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
</article>
<article>
<h2>Story 5</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum,
egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.</p>
</article>
</section>
<aside>
<header>
<h1>What's new?</h1>
</header>
<article>
<h2>What's new 1</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum
interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenas eget maximus sem, in
volutpat est.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum
interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenas eget maximus sem, in
volutpat est.</p>
</article>
<article>
<h2>What's new 2</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum
interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenas eget maximus sem, in
volutpat est.</p>
</article>
<article>
<h2>What's new 3</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum
interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenas eget maximus sem, in
volutpat est.</p>
</article>
</aside>
</div>
If I am understanding correctly, the aside is the notifications area, while the main content is to the left. I would use CSS Grid for this.
CSS:
.container {
display: grid;
grid-template-columns: repeat(2, 2fr) 1fr;
grid-gap: 2rem;
}
article {
background-color: beige;
margin-bottom: 1em;
min-height: 300px;
}
aside.notifications {
background-color: #171717;
color: #f5f5f5;
}
aside, article {
padding: 1rem;
}
HTML:
<main>
<h1>Welkom op Het bedrijf</h1>
<section class="container">
<article>
<p>
Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.
</p>
</article>
<article>
<p>
Lorem ipsum dolor sit amet,
consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenaseget maximus sem, in volutpat est.
</p>
</article>
<aside class="notifications">
<h2>Whats new?</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque euismod ex vel lobortis molestie. Pellentesque a ipsum interdum, egestas enim in, rutrum justo. Phasellus dictum luctus sem, at blandit diam tempor sed. Maecenas eget maximus sem, in volutpat est.
</p>
</aside>
</section>
</main>

Stack divs vertically & keep 2 column layout

I want to have two stacked divs on one side, and then have a single column on the other side with the same height as the left divs.
Kind of like this:
I have the two divs and a side bar, but the two divs won't stack.
Here is what I have so far Fiddle
#import url(https://fonts.googleapis.com/css?family=Oxygen);
body {
background-color: #222;
}
.description h1 {
text-align: left;
padding: 20px;
}
#wrapper {
text-align: center;
}
.description,
.sidebar,
.demo-container {
display: inline-block;
vertical-align: top;
}
.description {
background: #eee;
width: 50%;
font-family: "Oxygen";
font-size: 14px;
color: #000;
line-height: 1.2;
}
.sidebar {
background: #eee;
width: 15%;
height: 575px;
}
.demo-container {
background: #eee;
width: 50%;
font-family: "Oxygen";
font-size: 14px;
color: #000;
line-height: 1.2;
}
<div id='wrapper'>
<div class="demo-container">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pretium lorem nec tortor elementum.</p>
</div>
<div class="description">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pretium lorem nec tortor elementum.</p>
</div>
<div class="sidebar">
</div>
</div>
you are complicating a lot, here is a basic demo of what you want using flexbox
*,
*::before,
*::after {
box-sizing: border-box
}
body {
margin: 0
}
.flex {
display: flex;
flex-basis: 100%
}
.fl {
flex: 1;
display: flex;
flex-direction: column;
margin: 0 5px;
justify-content: space-between
}
.flex-item {
border: 1px solid black
}
.flex-item:not(:first-of-type) {
margin: 10px 0 0
}
.sidebar {
border: 1px solid black;
}
<div class="flex">
<div class="fl">
<div class="flex-item">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pretium lorem nec tortor elementum, et aliquam erat feugiat. Duis interdum enim vitae justo cursus pulvinar eu ac nulla. Donec consectetur vehicula turpis. Nunc laoreet tincidunt elit</p>
</div>
<div class="flex-item">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam pretium lorem nec tortor elementum, et aliquam erat feugiat. Duis interdum enim vitae justo cursus pulvinar eu ac nulla. Donec consectetur vehicula turpis. Nunc laoreet tincidunt elit
ultrices elementum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur augue magna, posuere id tortor vel, condimentum consectetur lacus. Pellentesque dui est, ornare vitae semper et, dapibus ut lacus.
Etiam sed porta dui. Phasellus non nisl eget dolor commodo imperdiet.</p>
</div>
</div>
<div class="fl sidebar"></div>
</div>
Just put <div class="sidebar"></div> before the other two divs, then float them all right. See fiddle https://jsfiddle.net/y71tkmtw/1/
.description,
.sidebar, .demo-container {
float: right;
margin: 40px;
}
Just add another <div> surrounding the 2 divs on the left-hand side, with float:left. Add float:right to the sidebar.
.left-container
{
width: 85%;
float:left;
}
.sidebar {
background: #eee;
width: 15%;
height: 575px;
float:right;
}
Fiddle: https://jsfiddle.net/dncgytef/2/

Set Min-Height of Background Color to Fit Page

I have a simple webpage with the center content with a red background. I'd like that background color to reach all the way to the bottom of the page, regardless of whether there is that much content in it or not.
I've tried various combinations of methods but nothing seems to stretch it correctly. In the Fiddle, I am attempting to use a flexbox but it doesn't appear to be working.
body {
background-color: white;
}
.main {
max-width: 80%;
background-color: red;
margin: 0 auto;
padding: 10px;
display: flex;
align-content: stretch;
flex-direction: row;
}
<section class="main">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce at aliquam dolor. Pellentesque a nibh in magna blandit elementum. Sed sodales porttitor dolor vel bibendum. Ut viverra justo in elit scelerisque, nec accumsan arcu facilisis. Nam ultricies
leo vitae felis sollicitudin lobortis. Cras nec nibh venenatis, bibendum neque at, suscipit lacus. Vestibulum interdum sodales cursus. Pellentesque feugiat eu velit venenatis egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
faucibus risus quis est pellentesque ultrices.
</p>
</section>
<section class="main">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</section>
body
{
background-color:white;
}
.main
{
max-width:80%;
background-color:red;
margin: 0 auto;
padding: 10px;
display:flex;
align-content:stretch;
flex-direction:row;
}
I've tried various combinations of methods but nothing seems to stretch it correctly
I assume that you don't want a flex ONLY solution, because you can actually achieve this without the flex, so if that's the point, than set the parent elements height to 100%
Demo
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
html,
body {
background-color: white;
height: 100%;
}
.main {
max-width: 80%;
background-color: red;
margin: 0 auto;
padding: 10px;
height: 100%;
}
<section class="main">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce at aliquam dolor. Pellentesque a nibh in magna blandit elementum. Sed sodales porttitor dolor vel bibendum. Ut viverra justo in elit scelerisque, nec accumsan arcu facilisis. Nam ultricies
leo vitae felis sollicitudin lobortis. Cras nec nibh venenatis, bibendum neque at, suscipit lacus. Vestibulum interdum sodales cursus. Pellentesque feugiat eu velit venenatis egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam
faucibus risus quis est pellentesque ultrices.
</p>
</section>
Also, you would see, am using the snippet below
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
will do nothing but count the borders, padding of the element inside instead of default box model which counts these outside the element, thus it won't result in vertical scroll as you were using padding and I used height: 100%; so as I explained, padding will be counted outside of the element, and will thus result in scroll.
box-sizing is a good option, its a CSS3 property.
I have one more option.
body, html {
min-height:100%;
height: 100%;
margin:0;
}
.innerBox {
min-height:100%;
width: 80%;
background: red;
margin: 0 auto;
}
<div class="innerBox">
Testing
</div>
What about using a new div for wrapping your content ?
Like this http://jsfiddle.net/MNQjk/2/
.block
{
max-width:80%;
background-color: red;
height: 1000px;
margin: 0 auto;
}