Strange behavior of the "column-count" property in Chrome - html

I used a column-count to split the text into columns and assigned the display: inline-block; for child elements to exclude text wrapping inside blocks. As a result, there was a strange behavior when rendering, for some reason a large indent appeared after the block of columns. Is this a bug of chrome or am I doing something wrong? Are there any ways around this?
Chrome 63.0.3239.108, Linux Mint
PS: In Firefox everything works well
.container {
padding: 20px;
max-width: 1024px;
}
.columns {
margin: 0;
column-count: 2;
column-gap: 20px;
}
p {
margin: 0 0 1em;
line-height: 1.5;
display: inline-block;
}
<div class="container">
<div class="columns">
<p>Lorem ipsum dolor amet roof party mumblecore raw denim lyft paleo ennui. Tbh PBR&B mustache, cray palo santo adaptogen sustainable iceland echo park yr kinfolk before they sold out pinterest. Salvia semiotics before they sold out, pitchfork next level vape unicorn. Pinterest poutine lumbersexual seitan bespoke, crucifix skateboard intelligentsia ramps.</p>
<p>Small batch lo-fi celiac, chillwave fingerstache lumbersexual gochujang succulents. Pitchfork small batch cornhole plaid flannel mlkshk 8-bit blog squid trust fund keytar portland asymmetrical skateboard intelligentsia. Tumeric beard succulents art party, meggings chillwave swag hashtag gochujang coloring book direct trade leggings sriracha pok pok. Cornhole food truck schlitz, snackwave art party hot chicken microdosing kale chips disrupt church-key.</p>
<p>Unicorn asymmetrical actually lomo whatever typewriter fixie dreamcatcher vegan pabst everyday carry. Salvia next level hella vegan williamsburg pug. Pabst DIY chartreuse disrupt occupy. Cornhole crucifix PBR&B thundercats gochujang tacos fanny pack you probably haven't heard of them chillwave normcore kitsch wayfarers dreamcatcher man bun echo park. La croix normcore cronut prism fam knausgaard roof party blog kinfolk try-hard etsy raclette ugh quinoa. PBR&B kickstarter pabst jean shorts. 90's cray vexillologist pabst.</p>
</div>
<p>Sriracha actually crucifix snackwave try-hard fam twee tilde kitsch lo-fi af. Af freegan cliche portland. Distillery pop-up whatever affogato lyft chicharrones tacos snackwave. Art party single-origin coffee iPhone palo santo fam XOXO gochujang chambray leggings venmo neutra cold-pressed direct trade whatever. Shaman post-ironic aesthetic gochujang.</p>
</div>

You can use CSS properties, such as break-inside, to specify that content should not be spread over multiple columns.
.container {
padding: 20px;
max-width: 1024px;
}
.columns {
margin: 0 0 1em;
column-count: 2;
column-gap: 20px;
}
p {
margin: 0 0 1em;
line-height: 1.5;
-webkit-column-break-inside: avoid;
-moz-column-break-inside:avoid;
-moz-page-break-inside:avoid;
page-break-inside: avoid;
break-inside: avoid-column;
}
<div class="container">
<div class="columns">
<p>Lorem ipsum dolor amet roof party mumblecore raw denim lyft paleo ennui. Tbh PBR&B mustache, cray palo santo adaptogen sustainable iceland echo park yr kinfolk before they sold out pinterest. Salvia semiotics before they sold out, pitchfork next level vape unicorn. Pinterest poutine lumbersexual seitan bespoke, crucifix skateboard intelligentsia ramps.</p>
<p>Small batch lo-fi celiac, chillwave fingerstache lumbersexual gochujang succulents. Pitchfork small batch cornhole plaid flannel mlkshk 8-bit blog squid trust fund keytar portland asymmetrical skateboard intelligentsia. Tumeric beard succulents art party, meggings chillwave swag hashtag gochujang coloring book direct trade leggings sriracha pok pok. Cornhole food truck schlitz, snackwave art party hot chicken microdosing kale chips disrupt church-key.</p>
<p>Unicorn asymmetrical actually lomo whatever typewriter fixie dreamcatcher vegan pabst everyday carry. Salvia next level hella vegan williamsburg pug. Pabst DIY chartreuse disrupt occupy. Cornhole crucifix PBR&B thundercats gochujang tacos fanny pack you probably haven't heard of them chillwave normcore kitsch wayfarers dreamcatcher man bun echo park. La croix normcore cronut prism fam knausgaard roof party blog kinfolk try-hard etsy raclette ugh quinoa. PBR&B kickstarter pabst jean shorts. 90's cray vexillologist pabst.</p>
</div>
<p>Sriracha actually crucifix snackwave try-hard fam twee tilde kitsch lo-fi af. Af freegan cliche portland. Distillery pop-up whatever affogato lyft chicharrones tacos snackwave. Art party single-origin coffee iPhone palo santo fam XOXO gochujang chambray leggings venmo neutra cold-pressed direct trade whatever. Shaman post-ironic aesthetic gochujang.</p>
</div>

Related

Can I limit the width of text inside of a <p>?

In Markdown images are wrapped inside of paragraphs. I'd like images to be wider than text and fill the container's larger width. How can I solve this? Here is an example: https://sidey.now.sh/2019/08/31/difference-between-font-formats/
Ideally the text would only have a width of 40rem.
You can solve this using CSS grid:
.container {
margin:0 50px;
border:1px solid;
}
.container >p {
display:grid;
grid-template-columns:1fr minmax(0,20rem) 1fr;
}
/* this pseudo element will take the first column and force the text to be on the middle one */
p::before {
content:"";
}
/**/
p > img {
grid-column:1/span 3; /* the image should take all the 3 columns (full width) */
}
img {
max-width:100%;
}
<div class="container">
<p>Lorem ipsum dolor amet tousled viral art party blue bottle single-origin coffee cardigan, selvage man braid helvetica. Banh mi taxidermy meditation microdosing. Selvage cornhole YOLO, small batch vexillologist raclette VHS prism sustainable 8-bit ugh semiotics letterpress disrupt pop-up. Celiac shabby chic ugh, jianbing whatever kitsch tattooed edison bulb kogi irony etsy.</p>
<p><img src="https://images.unsplash.com/photo-1580792214064-6102bf1948d5?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2167&q=80" alt="image"></p>
<p>Lorem ipsum dolor amet tousled viral art party blue bottle single-origin coffee cardigan, selvage man braid helvetica. Banh mi taxidermy meditation microdosing. Selvage cornhole YOLO, small batch vexillologist raclette VHS prism sustainable 8-bit ugh semiotics letterpress disrupt pop-up. Celiac shabby chic ugh, jianbing whatever kitsch tattooed edison bulb kogi irony etsy.</p>
</div>

Image has not same height as text

I want the image to be the same height as the text. Regardless of how long the text is.
I do not know where my mistake is and why it does not work.
I think that float: left is a problem. I used a Clearfix. It can not be so.
Flexbox shouldn't be used in this case.
The result should look like this:
This is my code:
* {
box-sizing: border-box;
margin:0;
padding: 0;
}
html{
font-size: 62.5%;
margin: 0;
padding: 0;
}
body {
font-family: 'Raleway', 'Lato', 'Helvetica Neue', 'Arial', sans-serif;
font-size: 1.6rem;
}
/* *** START: Clearfix *** */
.clearfix::after {
content:"";
clear: both;
display: block;
}
/* *** END: Clearfix *** */
section#test1 {
background-color: #3d3f45;
color: #fff;
margin-bottom: 0;
}
section#test1 div h1 {
text-align: center;
font-size: 3rem;
margin: 3rem 0;
padding-top: 4rem;
}
section#test1 div p {
margin-bottom: 1rem;
padding: 0 2rem;
}
section#test1 p:last-of-type {
padding-bottom: 4rem;
}
section#test1 .test2 > div {
display: inline-block;
}
section#test1 .test2 div:first-of-type {
float:left;
width: 70%;
}
section#test1 .test2 div:last-of-type {
float:right;
}
section#test1 .test2 div:last-of-type img {
height:100%;
width: auto;
}
<section id="test1">
<div>
<h1>Lorem Ipsum</h1>
</div>
<div class="test2 clearfix">
<div>
<p>Lorem ipsum dolor amet aesthetic forage tumeric kinfolk kickstarter, locavore meditation ugh. Vexillologist art party shoreditch meditation roof party. Beard ethical offal helvetica palo santo austin health goth. Hoodie venmo cold-pressed, green juice adaptogen hexagon neutra portland narwhal kale chips hashtag sriracha put a bird on it tofu. Beard banjo taiyaki readymade 90's, raclette art party irony lyft green juice humblebrag meh.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
<p>Etsy mumblecore banh mi banjo church-key +1. Fam YOLO salvia glossier actually affogato. Keytar af vinyl, literally man bun hell of normcore taxidermy lo-fi everyday carry. Iceland pork belly unicorn, pour-over trust fund live-edge brooklyn sustainable occupy truffaut. Banh mi chartreuse small batch photo booth pok pok PBR&B blog, taxidermy locavore. Sriracha farm-to-table scenester, shabby chic before they sold out chartreuse williamsburg coloring book letterpress unicorn hoodie.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
</div>
<div>
<img src="https://www1.xup.in/exec/ximg.php?fid=11811719" alt="Logo">
</div>
</div>
</section>
All you have to do is change the height 100% to the image parent div. I have given the class image to the image parent div and height to the test div.
HTML code
<section id="test1">
<div>
<h1>Lorem Ipsum</h1>
</div>
<div class="test2 clearfix">
<div class="paragraph">
<p>Lorem ipsum dolor amet aesthetic forage tumeric kinfolk kickstarter, locavore meditation ugh. Vexillologist art party shoreditch meditation roof party. Beard ethical offal helvetica palo santo austin health goth. Hoodie venmo cold-pressed, green juice adaptogen hexagon neutra portland narwhal kale chips hashtag sriracha put a bird on it tofu. Beard banjo taiyaki readymade 90's, raclette art party irony lyft green juice humblebrag meh.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
<p>Etsy mumblecore banh mi banjo church-key +1. Fam YOLO salvia glossier actually affogato. Keytar af vinyl, literally man bun hell of normcore taxidermy lo-fi everyday carry. Iceland pork belly unicorn, pour-over trust fund live-edge brooklyn sustainable occupy truffaut. Banh mi chartreuse small batch photo booth pok pok PBR&B blog, taxidermy locavore. Sriracha farm-to-table scenester, shabby chic before they sold out chartreuse williamsburg coloring book letterpress unicorn hoodie.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
<p>Literally small batch poutine distillery vice, trust fund gentrify. Ramps williamsburg swag woke. Lyft viral activated charcoal williamsburg. Neutra ennui fanny pack mustache pok pok sustainable activated charcoal. Artisan biodiesel ugh messenger bag woke activated charcoal vape heirloom meditation scenester deep v pour-over organic subway tile.</p>
</div>
<div class="image">
<img src="https://www1.xup.in/exec/ximg.php?fid=11811719" alt="Logo">
</div>
</div><!--/test2-->
</section>
CSS code--
.test2{
height:800px;
}
.image{
height:100%;
}

filling/sizing empty div in bootstrap

Hi I´m working on this bootstrap grid below.
I want this first column col-1 to have the same height as the two columns at its right side.
max-heightdoesn't seems to do the trick and I've been using:
.col-1{
background-color: #555;
margin-bottom: -600px;
padding-bottom: 600px;
}
to get the look I want, but then part of the div ends behind the other div´s when the site is scaled down.
Can anyone advise me how I can get the result I want?
I somehow believe that there must be another way to do this than I'm using which is to adjust the margin-bottomand padding-bottom
A link to fiddle
/* GRID */
.col-1 {
background-color: #555;
margin-bottom: -600px;
padding-bottom: 600px;
}
.col-2 {
background-color: #558C89;
}
.col-3 {
background-color: #74AFAD;
}
.col-4 {
background-color: #D9853B;
}
.col-5 {
background-color: #ECECEA;
}
.col-6 {
background-color: #F3FAB6;
}
.col-7 {
background-color: #CBE32D;
}
.col-8 {
background-color: #A8CD1B;
}
.col-9 {
background-color: #005A31;
}
/****************************/
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-md-6 col-1">
Some text here
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6 col-2">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies
salvia ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-6 col-3">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies
salvia ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-6 col-4">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies
salvia ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-6 col-5">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies
salvia ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3 col-6">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-3 col-7">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-3 col-8">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-3 col-9">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
</div>
</div>
Actually nowadays with current CSS we have, this below happens to be a ugly hack.
.col-1{
background-color: #555;
margin-bottom: -600px;
padding-bottom: 600px;
}
So, use flexbox:
body,
p {
margin: 0 !important
}
body {
padding-top: 70px;
}
/* NAVBAR */
.navbar-header {
float: none;
}
.navbar-toggle {
display: block;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
}
.navbar-nav>li {
float: none;
}
.navbar-collapse.collapse.in {
display: block !important;
}
/****************************/
/* GRID */
span.glyphicon {
display: block;
text-align: center;
font-size: 5em;
padding-top: 15%;
}
.container > .row {
display: flex;
flex-wrap: wrap
}
#media (max-width: 992px) {
.container > .row > [class^="col-"] {
flex: 0 0 100%;
}
}
.col-1 {
background-color: #555;
border: solid 5px #fff;
}
.col-2 {
background-color: #558c89;
border: 5px solid #fff;
min-height: 250px;
}
.col-3 {
background-color: #74AFAD;
min-height: 250px;
padding: 5px;
border: solid 5px #fff;
}
.col-4 {
background-color: #D9853B;
min-height: 250px;
padding: 5px;
border: solid 5px #fff;
}
.col-5 {
background-color: #ECECEA;
min-height: 250px;
padding: 5px;
border: solid 5px #fff;
}
.col-6 {
background-color: #F3FAB6;
min-height: 250px;
border: solid 5px #fff;
}
.col-7 {
background-color: #CBE32D;
min-height: 250px;
border: solid 5px #fff;
}
.col-8 {
background-color: #A8CD1B;
min-height: 250px;
border: solid 5px #fff;
}
.col-9 {
background-color: #005A31;
min-height: 250px;
border: solid 5px #fff;
}
/****************************/
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<div class="container">
<div class="row">
<div class="col-md-6 col-1 row-eq-height">
Daði Hall
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-6 col-2 text-center">
<p>Web design</p>
<span class="glyphicon glyphicon-console" aria-hidden="true"></span>
</div>
<div class="col-md-6 col-3">
<p>Blog</p>
<span class="glyphicon glyphicon-text-size" aria-hidden="true"></span>
</div>
<div class="col-md-6 col-4">
<p>CV</p>
<span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span>
</div>
<div class="col-md-6 col-5">
<p>Photos</p>
<span class="glyphicon glyphicon-camera" aria-hidden="true"></span>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-3 col-6">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-3 col-7">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-3 col-8">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
<div class="col-md-3 col-9">
<p>Celiac 3 wolf moon williamsburg pitchfork, squid helvetica single-origin coffee brooklyn paleo vice biodiesel. Fingerstache celiac mumblecore, try-hard yuccie helvetica chartreuse. Chartreuse wayfarers vegan, blue bottle bicycle rights selfies salvia
ugh drinking vinegar 3 wolf moon you probably haven't heard of them. Cardigan fingerstache freegan 3 wolf moon vegan. Venmo umami 8-bit, cronut raw denim direct trade locavore vinyl seitan plaid tousled.</p>
</div>
</div>
</div>
.col-1 {
background-color: #555;
}
#media(min-width: 992px) {
.col-1 {
margin-bottom: -600px;
padding-bottom: 600px;
}
}
JSFIDDLE

Vertically position three elements: flexible box, scroll box & fixed box

Is the following even possible with css? If not, what javascript events would be used even if the green box changes content?
I'd like to vertically position three boxes:
The first one (the green one) can have some variable amount of content, and the box should expand to fit the content. This box should be flush with the top of the browser.
The last one, the yellow one, will have a fixed amount of content (meaning I know what the content is at 'compile time'). This box should be flush with the bottom of the browser.
The middle one, the red one, will have a flexible amount of content, and should extend from the bottom of the green box to the top of the yellow box, and internally it needs to be scrollable if its content is larger than the box size.
This is what I've got so far, and it doesn't quite work - I can't seem to make the bottom of the yellow box flush with the bottom of the viewport in such a way as to let the red box take up all the extra space (i.e. position: absolute doesn't seem to help).
#container {
float: left;
height: 100%;
background-color:gray;
}
#header {
background-color: green;
}
#main {
overflow: auto;
background-color: red;
height: 70%;
}
#footer {
background-color:yellow;
}
<div id="container">
<div id="header">START OF HEADER CONTENT...</div>
<div id="main">Craft beer jean shorts...</div>
<div id="footer">footer some stuff goes here</div>
</div>
And this is what it looks like:
Here's a jsfiddle: https://jsfiddle.net/n6cmdcj3/, but note it might not help, as the html box doesn't obey the viewport size - not sure how to make it so
This can be done fairly easily with flexbox. Check out the support tables for compatibility.
html,
body {
width: 100%;
height: 100%;
}
#container {
float: left;
height: 100%;
background-color: purple;
position: relative;
display: flex;
flex-direction: column;
}
#header {
background-color: green;
}
#main {
overflow: hidden;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
background-color: red;
flex: 1;
flex-grow: 1;
}
#footer {
background-color:yellow;
}
<body>
<div id="container">
<div id="header">
START OF HEADER CONTENT and the viewer should be able to see all of it. Ipsum Blaster jango fett alderaan data dooku validium hypercube. Antilles mace windu uhura xindi millenium falcon bothan exterminate tylium ore. Endor maul skywalker everlasting matches antilles FTL tylium ore dooku. Paradox machine padawan speeder doctor who chewbacca AT-AT frack dagobah ice gun. Uhura data photon torpedo worf landspeeder starbuck hypercube cantina. END OF HEADER CONTENT
</div>
<div id="main">
Craft beer jean shorts beard green juice, kinfolk 8-bit hoodie single-origin coffee letterpress seitan four dollar toast hammock occupy selfies pug. Retro locavore meditation craft beer viral, vinyl health goth cred butcher echo park. Echo park portland helvetica roof party hammock, food truck messenger bag pop-up poutine master cleanse hella artisan etsy. Celiac polaroid before they sold out tousled chillwave farm-to-table, leggings craft beer mlkshk viral seitan vegan intelligentsia. Yuccie synth poutine next level food truck, meggings chambray aesthetic farm-to-table marfa helvetica dreamcatcher blue bottle mumblecore brunch. Fixie narwhal lomo, art party pinterest direct trade poutine mlkshk organic forage irony. Wolf kickstarter authentic dreamcatcher plaid.
Yuccie tilde try-hard selfies gentrify DIY. Offal celiac gentrify cornhole, chia beard scenester quinoa freegan marfa thundercats pour-over synth. Migas salvia franzen pabst, blog listicle freegan chia YOLO fashion axe locavore offal. Paleo whatever messenger bag, 3 wolf moon normcore aesthetic humblebrag pug narwhal lo-fi lomo lumbersexual. Chambray yuccie selfies, tattooed biodiesel pitchfork artisan mixtape actually iPhone single-origin coffee 8-bit master cleanse aesthetic. Kickstarter chillwave VHS tousled green juice. Meggings mumblecore gentrify chambray blue bottle brooklyn.
Four dollar toast sriracha hammock iPhone authentic, quinoa wayfarers pop-up taxidermy post-ironic next level offal YOLO chartreuse fingerstache. Forage salvia direct trade photo booth YOLO, fixie paleo sartorial deep v. Distillery art party pop-up meggings sartorial thundercats vice, portland jean shorts flannel readymade godard. 3 wolf moon single-origin coffee you probably haven't heard of them chillwave selfies cred. Scenester asymmetrical seitan blue bottle bitters banh mi swag, etsy disrupt 90's. Kombucha normcore echo park, photo booth bushwick stumptown retro before they sold out. Chillwave art party heirloom ugh.
Cliche authentic paleo fingerstache banjo actually artisan sriracha helvetica twee, trust fund portland PBR&B. Aesthetic pork belly pop-up bitters distillery, banh mi try-hard cred meditation letterpress schlitz 90's celiac neutra. Irony street art actually cliche cray asymmetrical. Bicycle rights kombucha beard crucifix, deep v cray 3 wolf moon listicle before they sold out shabby chic distillery pitchfork. Meh aesthetic tacos flannel, pug paleo DIY austin. Gastropub kinfolk cliche crucifix, swag post-ironic irony heirloom keytar thundercats 8-bit beard. You probably haven't heard of them migas marfa leggings normcore.
Four loko gentrify ramps, mixtape sartorial fashion axe ethical organic meditation williamsburg. Blue bottle freegan synth hoodie, swag bitters letterpress chillwave pop-up. Hella chicharrones next level ramps chillwave, portland freegan tattooed neutra disrupt austin 3 wolf moon kale chips roof party. Lumbersexual try-hard cold-pressed, affogato offal bushwick thundercats stumptown. Leggings knausgaard gastropub, raw denim bitters lo-fi four dollar toast tilde truffaut meh. Truffaut umami artisan, irony affogato tattooed literally yuccie pabst chia wolf hammock craft beer photo booth. Lomo roof party tumblr thundercats meggings ennui messenger bag, next level franzen synth kickstarter pork belly vegan.
</div>
<div id="footer">
footer some stuff goes here
</div>
</div>
</body>
#container {
float: left;
height: 100%;
background-color:gray;
position: relative;
}
#header {
background-color: green;
height: auto;
}
#main {
overflow: auto;
background-color: red;
height: 70%;
overflow-y: scroll
-webkit-overflow-y: scroll;
-moz-overflow-y: scroll;
}
#footer {
background-color:yellow;
height: 25px;
}
I would do it this way. No reason to get too complicated.
Link: https://jsfiddle.net/n6cmdcj3/3/
I would also utilize set pixels for the main id, since you are trying to establish a scrolling content div.
Correct me if I'm wrong but, I also believe these should be classes not id. Classes are for reusable names, for example, you would utilize a class to update all the color of the divs but you would not utilize an id. An ID would be used in the cases of you needing something specific that will not be implemented anywhere else on the site. It's just good programming practice and it pays out later on when you are using JavaScript.
ID = Single Change Element
Class = Reusable multiple Elements.
Josh Rutherford's answer is great for flexbox. If you want to use a more traditional layout, you will have to set the top element to a fixed height and use vh units. The CSS will look like this:
.container {
height: 100vh;
}
.top {
background-color: #f2f2f2;
height: 24vh;
overflow: hidden;
padding: 20px;
}
.middle {
background-color: #h2h2h2;
height: 55vh;
padding: 20px;
overflow-y: scroll;
}
.bottom {
background-color: #d2d2d2;
height: 3vh;
padding: 20px;
position: fixed;
bottom: 0;
width: 100%;
}
Demo on CodePen: http://codepen.io/staypuftman/pen/eJvdYv

Why isn't this image adjusting to the width size, if it is inside the container that I am specifying to width size?

I am attempting to adjust all width sizes of inside the container. So all sides will be 80%. Why isn't the image adjusting as well? I'm expecting the image to not be so spread out to the right as it is now. I am expecting it to be aligned with everything else.
Here is the main HTML and CSS code attempting to do the above:
.container {
width: 80%;
margin: 0 auto;
}
<div class="container">
<div class="header">
<h1>About me </h1>
</div>
<div class="image">
<img src="http://lorempixel.com/1400/300" />
</div>
<div class="intro column">
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
<div class="skills column">
<ul id="skill-list">
<li>1</li>
<li>2</li>
<li>3</li>
</ul>
</div>
<div class="main_text">
<p>
Small batch wolf pug bicycle rights, letterpress kitsch Etsy listicle farm-to-table. Hoodie flannel Pitchfork normcore chambray, polaroid viral before they sold out. Wes Anderson skateboard single-origin coffee fixie shabby chic pour-over, four loko typewriter. Banksy American Apparel sartorial, irony XOXO plaid narwhal cred mumblecore keffiyeh asymmetrical sriracha. Marfa PBR lomo four loko aesthetic master cleanse, Pitchfork church-key bitters sartorial beard keffiyeh Thundercats. Mixtape aesthetic mustache readymade Blue Bottle, Banksy Wes Anderson Intelligentsia Kickstarter cliche biodiesel normcore farm-to-table polaroid narwhal. Semiotics mixtape Portland kale chips, heirloom Carles seitan pickled 3 wolf moon church-key master cleanse fingerstache.
</p>
<p>
Tofu pork belly pug Tumblr crucifix. XOXO 3 wolf moon whatever, narwhal Vice Blue Bottle distillery PBR&B lumbersexual forage tattooed leggings 90's letterpress. Brooklyn pork belly umami hashtag gentrify tilde. Blog pork belly Godard mlkshk. Kitsch letterpress kale chips narwhal messenger bag. Migas farm-to-table banjo hella. Taxidermy lo-fi mlkshk normcore paleo DIY, tofu VHS lumbersexual ugh listicle.
</p>
</div>
</div> <!-- end container -->
Images with no style on them automatically default to their true size (ex. a 1400px by 300px image will be 1400px by 300px on the screen), as #MrLister said in his comment. You could do something like this:
img {
width: 100%;
}
to set the image width to 100% of its parent's width.
Width property isn't inherited. so the width of the container is 80% of its parent (the body element). but the width of the image is its true size.
To change its width add a css style.
img{
width: 100%;
}
this changes its width to 100% of its parent (the container).
*performance note: It's better to change the size of the picture itself rather than use the width property because you download the whole picture then resize it which means useless data download.