Responsive content with height limited to screen size - html

For the last couple of days I am working in a simple step by step tutorial layout (html/css), and I cannot make it responsive and limited to screen size at same time.
Here is what I have so far and what I am trying to do:
HTML:
<div id="tutorial">
<h1>Step 2 - Title</h1>
<h3>Second step description / instructions</h3>
<div id="content">
<div id="ctrls">
<img src="images/prev.png">
<img src="images/stop.png">
<img src="images/next.png">
</div>
<div id="image">
<img src="images/step2.jpg">
</div>
</div>
<div id="controls">
<div class="btn prev">
<img src="images/btn_prev.png">
<div class="btn next">
<img src="images/btn_next.png">
</div>
</div>
</div>
CSS:
* {
margin: 0;
padding: 0;
}
html, body {
overflow: hidden;
font-family: Arial;
}
#tutorial {
width: 100%;
height: 100vh;
background-color: #FFFFCC;
}
h1 {
padding: 20px;
font-size: 26px;
font-weight: bold;
text-align: center;
}
h3 {
font-size: 20px;
text-align: center;
font-weight: normal;
}
#content {
display: table;
margin: 0 auto;
padding: 16px;
height: calc(100vh - 220px);
background-color: #E6E6E6;
}
#content #image {
position: relative;
}
#content #image img {
width: 100%;
height: 100%;
max-height: 100%;
}
#content #ctrls {
position: absolute;
z-index: 99;
display: table;
padding: 2px;
}
#content #ctrls img {
width: 48px;
height: auto;
float: left;
}
#controls {
display: table;
margin: 4px auto;
}
#controls .btn {
margin-top: 6px;
float: left;
}
#controls .prev {
margin-right: 10px;
}
#controls .next {
margin-left: 10px;
}
#controls .off {
opacity: 0.4;
filter: alpha(opacity=40);
}
#controls .btn img {
border: 0;
}
Thank you for any help!

Try this variant. I rewrote your code a bit...
https://codepen.io/opmasan/pen/jObdmdd
:root {
--header-height: 100px;
--footer-height: 200px;
}
*{
margin: 0;
padding: 0;
}
html, body {
font-family: Arial;
}
#tutorial {
width: 100%;
height: 100vh;
background-color: #FFFFCC;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
h1 {
padding: 20px;
font-size: 26px;
font-weight: bold;
text-align: center;
}
h3 {
font-size: 20px;
text-align: center;
font-weight: normal;
}
#content {
display: flex;
padding: 16px;
background-color: #E6E6E6;
}
#content #image {
position: relative;
}
#content #image img {
height: calc(100vh - var(--header-height) - var(--footer-height));
max-height:100%;
max-width: 100%;
object-fit: cover;
}
#content #ctrls {
position: absolute;
z-index: 99;
width: 100px;
height: 50px;
background-color: #3AE2CE;
}
#controls {
display: flex;
margin: 4px auto;
}
#controls .btn {
margin-top: 6px;
float: left;
}
#controls .prev {
margin-right: 10px;
}
#controls .next {
margin-left: 10px;
}
#controls .off {
opacity: 0.4;
filter: alpha(opacity=40);
}

Remove height: calc(100vh - 220px); from your content div.
Then, Just declare the div size and make the image size 100%.
#image{
height:200px;
width:200px;
}
#image img{
height:100%;
width:100%;
}

https://codepen.io/opmasan/pen/JjYxJgv
This variant with object-fit: contain and some fixes in html will be better:
#content #image img {
object-fit: contain;
}

Related

Navbar pushes DIV's off screen

The purple Navbar at the top of the page pushes the container "container2" off screen. Is there any possible way I can make it so the "container2" div does not overflow with the proper padding of 5px at the bottom?
#import url('https://fonts.googleapis.com/css2?family=Gugi&display=swap');
/*QuickReset*/ * { box-sizing: border-box; margin: 0; }
html {
height: 100%;
width: 100%
}
body {
background: black;
height: 100%;
position: relative;
overflow: hidden;
}
.navbar {
background: purple;
padding: 1em;
width: 100%;
position: relative;
top: 0;
}
.navbar .logo {
text-decoration: none;
font-family: 'Gugi', cursive;
font-weight: bold;
font-size: 1.5em;
color: white;
}
.navbar .container {
display: grid;
grid-template-columns: 100px auto;
justify-content: unset;
}
.navbar nav {
display: flex;
justify-content: space-between;
background: none;
position: unset;
height: auto;
width: 100%;
padding: 0;
}
.container2 {
display: flex;
width: 100%;
height: 100%;
position: relative;
gap: 5px;
padding: 5px;
}
.one,
.two {
border: 3px solid green;
border-radius: 5px;
}
.one { width: 10%; background: red; }
.two { width: 90%; background: blue; }
<div class="navbar">
<div class="container">
<a class="logo" href="#">Logo</a>
</div>
</div>
<div class="container2">
<div class="one">
</div>
<div class="two">
</div>
</div>
Resulting Page
I am new to HTML and CSS so any helps greatly appreciated.
Stack overflow wants more content besides code but im not too sure what else to add.
Remove overflow: hidden from body:
#import url('https://fonts.googleapis.com/css2?family=Gugi&display=swap');
/*QuickReset*/
* {
box-sizing: border-box;
margin: 0;
}
html {
height: 100%;
width: 100%
}
body {
background: black;
height: 100%;
position: relative;
/*overflow: hidden;*/
}
.navbar {
background: purple;
padding: 1em;
width: 100%;
position: relative;
top: 0;
}
.navbar .logo {
text-decoration: none;
font-family: 'Gugi', cursive;
font-weight: bold;
font-size: 1.5em;
color: white;
}
.navbar .container {
display: grid;
grid-template-columns: 100px auto;
justify-content: unset;
}
.navbar nav {
display: flex;
justify-content: space-between;
background: none;
position: unset;
height: auto;
width: 100%;
padding: 0;
}
.container2 {
display: flex;
width: 100%;
height: 100%;
position: relative;
gap: 5px;
padding: 5px;
}
.one,
.two {
border: 3px solid green;
border-radius: 5px;
}
.one {
width: 10%;
background: red;
}
.two {
width: 90%;
background: blue;
}
<div class="navbar">
<div class="container">
<a class="logo" href="#">Logo</a>
</div>
</div>
<div class="container2">
<div class="one">
</div>
<div class="two">
</div>
</div>
#import url('https://fonts.googleapis.com/css2?family=Gugi&display=swap');
/*QuickReset*/ * { box-sizing: border-box; margin: 0; }
body {
background: black;
height: 100vh;
position: relative;
overflow: hidden;
}
.navbar {
background: purple;
padding: 1em;
width: 100%;
position: relative;
top: 0;
height: 20%;
}
.navbar .logo {
text-decoration: none;
font-family: 'Gugi', cursive;
font-weight: bold;
font-size: 1.5em;
color: white;
}
.navbar .container {
display: grid;
grid-template-columns: 100px auto;
justify-content: unset;
}
.navbar nav {
display: flex;
justify-content: space-between;
background: none;
position: unset;
height: auto;
width: 100%;
padding: 0;
}
.container2 {
display: flex;
width: 100%;
height: 80%;
position: relative;
gap: 5px;
padding: 5px;
}
.one,
.two {
border: 3px solid green;
border-radius: 5px;
}
.one { width: 10%; background: red; }
.two { width: 90%; background: blue; }
<div class="navbar">
<div class="container">
<a class="logo" href="#">Logo</a>
</div>
</div>
<div class="container2">
<div class="one">
</div>
<div class="two">
</div>
</div>
you should divide the height of navbar and container 2

Sticky Footer Error with CSS

I've tried everything and can't seem to get the footer to stick to the bottom.
I've been moving things around, might have messed up the codes a bit.
I'm fine with how it is on longer (more content) pages. But it's giving me to much white space on pages with less content.
Help would be appreciated!
#charset "UTF-8";
* {
margin: 0;
}
/* Body */
html, body {
font-family: 'Questrial', sans-serif;
background-image: url('mila_background_btm.png');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: bottom;
margin: 0;
padding: 0;
min-height: 100%;
}
/* Text */
h1 {
text-align: center;
margin-top: 30px;
margin-bottom: 30px;
color: #3A3366
}
h2 {
text-align: center;
margin-top: 20px;
color: #2D4B5B;
margin-bottom: 20px;
}
p {
margin-top: 1;
text-align: center;
line-height: 150%;
}
/* Container */
.container {
width: 90%;
margin-top: 10px;
margin-left: auto;
margin-right: auto;
text-decoration: none;
height: 100%;
padding-bottom: 50px;
}
/* Navigation */
header {
font-family: 'Questrial', sans-serif;
width: 90%;
height: 9%;
background-color: #fff;
border-bottom: 2px solid #312f47;
text-decoration: none;
margin-left: auto;
margin-right: auto;
}
nav {
float: right;
width: 70%;
text-align: right;
margin-right: 0px;
margin-top: 35px;
}
nav a {
font-size: 1rem;
padding: .5rem;
text-decoration: none;
color: #312f47;
}
a:hover {
background: #312f47;
color: white;
}
nav a:first-child {
display: none;
}
.current {
color: #9390A6;
}
/* Images */
.gallery {
margin-bottom: 100px;
height: 100%;
}
.photos {
max-width: 50%;
}
.contact {
display: block;
margin: auto;
margin-top: 50px;
}
/* Google Maps */
.google-maps {
position: relative;
padding-bottom: 16.6%;
height: 0;
overflow: hidden;
margin-top: 50px;
}
.google-maps iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video
{
position: relative;
padding-bottom: 56.25%;
padding-top: 80px;
height: 0;
overflow: hidden;
margin-top: 50px;
}
.video iframe
{
position: absolute;
top: 0;
left: 15%;
width: 70%;
height: 70%;
}
/* Footer */
footer {
font-size: 8pt;
color: #707070;
text-align: center;
height: 50px;
margin-top: 50px;
position: relative;
}
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="container">
<header>
<nav>
</nav>
</header>
</div>
<footer>
</footer>
</body>
</html>
You have no text between the footer tags that is why you do not see the footer and if you add background color it will be much more clear.
For example you should add class="site-footer" to the html footer tag.
<footer class="site-footer">
The Footer.
</footer>
And the class definitions in the CSS file:
.site-footer{
height: 120px;
background: red;
}
You can also use the link for reference.
I'm using this for footer and its working perfect with me :
html,body,ul,a,li{
margin:0;
padding:0;
border:0;
outline:none;
vertical-align:top;
height:100%;
text-decoration:none;
}
.wrap{width:100%;
min-height:100%;
height: auto !important;
height:100%;margin:0 auto;
display:block;
background:lightblue;}
footer{
bottom:0px;
display:block;
width:100%;
height:auto;}
#fo-wrap{width:100%;
height:100px;
background-color:#FF2E99;}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div class='wrap'>
here every thing in page
</div>
<footer>
<div id='fo-wrap'>
here footer content
</div>
</footer>
</body>
</html>
Add a min-height for .content relative to the viewport.
Decremented 110px from it (padding-bottom: 50px; margin-top: 10px; footer height: 50px)
footer {
font-size: 8pt;
color: #707070;
text-align: center;
height: 50px;
margin-top: 50px;
position: fixed;
bottom: 0;
width: 100%;
background-color: #ccc;
}
#charset "UTF-8";
* {
margin: 0;
}
/* Body */
html, body {
font-family: 'Questrial', sans-serif;
background-image: url('mila_background_btm.png');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: bottom;
margin: 0;
padding: 0;
min-height: 100%;
}
/* Text */
h1 {
text-align: center;
margin-top: 30px;
margin-bottom: 30px;
color: #3A3366
}
h2 {
text-align: center;
margin-top: 20px;
color: #2D4B5B;
margin-bottom: 20px;
}
p {
margin-top: 1;
text-align: center;
line-height: 150%;
}
/* Container */
.container {
width: 90%;
margin-top: 10px;
margin-left: auto;
margin-right: auto;
text-decoration: none;
height: 100%;
padding-bottom: 50px;
}
/* Navigation */
header {
font-family: 'Questrial', sans-serif;
width: 90%;
height: 9%;
background-color: #fff;
border-bottom: 2px solid #312f47;
text-decoration: none;
margin-left: auto;
margin-right: auto;
}
nav {
float: right;
width: 70%;
text-align: right;
margin-right: 0px;
margin-top: 35px;
}
nav a {
font-size: 1rem;
padding: .5rem;
text-decoration: none;
color: #312f47;
}
a:hover {
background: #312f47;
color: white;
}
nav a:first-child {
display: none;
}
.current {
color: #9390A6;
}
/* Images */
.gallery {
margin-bottom: 100px;
height: 100%;
}
.photos {
max-width: 50%;
}
.contact {
display: block;
margin: auto;
margin-top: 50px;
}
/* Google Maps */
.google-maps {
position: relative;
padding-bottom: 16.6%;
height: 0;
overflow: hidden;
margin-top: 50px;
}
.google-maps iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.video
{
position: relative;
padding-bottom: 56.25%;
padding-top: 80px;
height: 0;
overflow: hidden;
margin-top: 50px;
}
.video iframe
{
position: absolute;
top: 0;
left: 15%;
width: 70%;
height: 70%;
}
.container {
min-height: calc(100vh - 110px)
}
/* Footer */
footer {
font-size: 8pt;
color: #707070;
text-align: center;
height: 50px;
width: 100%;
background-color: #ccc;
}
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<div class="container">
<header>
<nav>
</nav>
</header>
</div>
<footer>
My footer
</footer>
</body>
</html>

Reposition background-image according to display size and unknown margins

did this for my homepage and wanted to background image content to be the middle of the image as the display size decreases (right now it slides the content of the image to the left). Thought of media query but Client only allows for one add-on of CSS, not different stylesheet files.
Also, although stated * margin= 0; padding=0 a margin appears on my smartphone (Iphone 6) and want it to be clear full screen as in desktop. Make browser pretty small to see if from laptop/desktop.
It has to be CSS ONLY since my client (Smugmug) only allows for blocks of css and html on it, no javascript or whatsoever. Also adds its own CSS to the page so I can post the link if needed.
Any idea for the dynamic positioning of the images and the margins? Thanks!
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding; 0;
}
body {
display: flex;
flex-direction: column;
}
h1 {
margin: 0;
}
a {
display: inline-block;
}
#business-top {
display: flex;
flex: 1;
height:50vh;
width: 100%;
align-items: center;
justify-content: center;
text-align: center;
background-image : url(https://lluisballbe.smugmug.com/Assets-for-website/i-2KvXfrk/0/X3/_MG_9556-X3.jpg
);
background-size:cover;
}
#business-button {
transition: all 1s;
-webkit-transition: all 1s;
height: 3em;
width: 12em;
background-color: #2B2A2A;
border: .2em solid #ff7600;
border-radius: 1.8em;
margin: auto;
text-align:center;
}
#logo-separator {
text-align: center;
top: calc( 50%-height_of_separator)px;
}
.separator {
display: block;
position: relative;
padding: 0;
height: 0;
width: 100%;
max-height: 0;
font-size: 1px;
line-height: 0;
flex: 0;
border-top: 1px solid #ff7600;
border-bottom: 1px solid #ff7600;
}
#logo {
margin: auto;
max-width: 150px;
display: inline-block;
overflow: hidden;
margin: -75px;
position: absolute;
z-index:1;
}
#photography-bottom {
display: flex;
flex: 1;
width: 100%;
height:50vh;
align-items: center;
justify-content: center;
background-image : url(https://lluisballbe.smugmug.com/Assets-for-website/i-gPg5QBt/0/X3/_DSC5313-X3.jpg
);
background-size:cover;
}
#photography-button {
height: 3em;
width: 12em;
background-color: #2B2A2A;
border: .2em solid #ff7600;
border-radius: 1.8em;
margin: auto;
}
h1 {
color: #ff7600;
text-align: center;
font-size: 1.4em;
vertical-align: middle;
line-height: 2.2em
}
#business-top,
#photography-bottom {
pointer-events: none;
position: relative;
transition: 1s;
min-height: 200px;
}
#business-top a,
#photography-bottom a {
pointer-events: auto;
}
<div id="business-top">
<a href="www.lluisballbe.smugmug.com">
<div id="business-button">
<h1>PHOTOGRAPHY</h1>
</div>
</a>
</div>
<div id="logo-separator">
<div class="separator"></div>
<div id="logo"><img src="https://lluisballbe.smugmug.com/Assets-for-website/i-CsMnM3R/0/Th/800x800-round-Th.png"> </div>
</div>
<div id="photography-bottom">
<a href="www.lluisballbe.smugmug.com">
<div id="photography-button">
<h1>BUSINESS</h1>
</div>
</a>
</div>
you need to use background-position if you want to position a background image.
html,
body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body {
display: flex;
flex-direction: column;
}
h1 {
margin: 0;
}
a {
display: inline-block;
}
#business-top {
display: flex;
flex: 1;
height:50vh;
width: 100%;
align-items: center;
justify-content: center;
text-align: center;
background-position: center center;
background-image : url(https://lluisballbe.smugmug.com/Assets-for-website/i-2KvXfrk/0/X3/_MG_9556-X3.jpg
);
background-size:cover;
}
#business-button {
transition: all 1s;
-webkit-transition: all 1s;
height: 3em;
width: 12em;
background-color: #2B2A2A;
border: .2em solid #ff7600;
border-radius: 1.8em;
margin: auto;
text-align:center;
}
#logo-separator {
text-align: center;
top: calc( 50%-height_of_separator)px;
}
.separator {
display: block;
position: relative;
padding: 0;
height: 0;
width: 100%;
max-height: 0;
font-size: 1px;
line-height: 0;
flex: 0;
border-top: 1px solid #ff7600;
border-bottom: 1px solid #ff7600;
}
#logo {
margin: auto;
max-width: 150px;
display: inline-block;
overflow: hidden;
margin: -75px;
position: absolute;
z-index:1;
}
#photography-bottom {
display: flex;
flex: 1;
width: 100%;
height:50vh;
align-items: center;
justify-content: center;
background-position: center center;
background-image : url(https://lluisballbe.smugmug.com/Assets-for-website/i-gPg5QBt/0/X3/_DSC5313-X3.jpg
);
background-size:cover;
}
#photography-button {
height: 3em;
width: 12em;
background-color: #2B2A2A;
border: .2em solid #ff7600;
border-radius: 1.8em;
margin: auto;
}
h1 {
color: #ff7600;
text-align: center;
font-size: 1.4em;
vertical-align: middle;
line-height: 2.2em
}
#business-top,
#photography-bottom {
pointer-events: none;
position: relative;
transition: 1s;
min-height: 200px;
}
#business-top a,
#photography-bottom a {
pointer-events: auto;
}
<div id="business-top">
<a href="www.lluisballbe.smugmug.com">
<div id="business-button">
<h1>PHOTOGRAPHY</h1>
</div>
</a>
</div>
<div id="logo-separator">
<div class="separator"></div>
<div id="logo"><img src="https://lluisballbe.smugmug.com/Assets-for-website/i-CsMnM3R/0/Th/800x800-round-Th.png"> </div>
</div>
<div id="photography-bottom">
<a href="www.lluisballbe.smugmug.com">
<div id="photography-button">
<h1>BUSINESS</h1>
</div>
</a>
</div>
add this css property to your both divs
background-position: center;
as example like this
#business-top {
display: flex;
flex: 1;
height:50vh;
width: 100%;
align-items: center;
justify-content: center;
text-align: center;
background-image : url(https://lluisballbe.smugmug.com/Assets-for-website/i-2KvXfrk/0/X3/_MG_9556-X3.jpg);
background-position: center;
}
do like this for your other div and try.

Homepage divided layout (CSS)

I want to create this homepage for my site which only accepts add-ons of html/css without retouching any other rule.
Only achieved making the blocks themselves but no clue on how to put images behind the buttons,center everything up and make it responsive...
Any tip?
Homepage intended
page link: www.lluisballbe.smugmug.com
Code used already is here:
html,
body {
height: 100%;
width: 100%;
margin: 0;
}
body {
display: flex;
flex-direction: column;
}
h1 {
margin: 0;
}
a {
display: inline-block;
}
#business-top {
display: flex;
flex: 1;
width: 100%;
align-items: center;
justify-content: center;
text-align: center;
background:turquoise;
}
#business-button {
height: 3em;
width: 12em;
background-color: #2B2A2A;
border: .2em solid #ff7600;
border-radius: 1.8em;
margin: auto;
}
#logo-separator {
text-align: center;
}
.separator {
display: block;
position: relative;
padding: 0;
height: 0;
width: 100%;
max-height: 0;
font-size: 1px;
line-height: 0;
flex: 0;
border-top: 1px solid #ff7600;
border-bottom: 1px solid #ff7600;
}
#logo {
margin: auto;
max-width: 150px;
display: inline-block;
overflow: hidden;
margin: -75px;
position: absolute;
z-index:1;
}
#photography-bottom {
display: flex;
flex: 1;
width: 100%;
align-items: center;
justify-content: center;
background:gray;
}
#photography-button {
height: 3em;
width: 12em;
background-color: #2B2A2A;
border: .2em solid #ff7600;
border-radius: 1.8em;
margin: auto;
}
h1 {
color: #ff7600;
text-align: center;
font-size: 1.4em;
vertical-align: middle;
line-height: 2.2em
}
#business-top,
#photography-bottom {
pointer-events: none;
position: relative;
transition: 1s;
min-height: 200px;
}
#business-top a,
#photography-bottom a {
pointer-events: auto;
}
#business-top:hover,
#photography-bottom:hover {
flex: 3;
}
#business-top a:hover:before,
#photography-bottom a:hover:before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
<div id="business-top">
<a href="www.lluisballbe.smugmug.com">
<div id="business-button">
<h1>BUSINESS</h1>
</div>
</a>
</div>
<div id="logo-separator">
<div class="separator"></div>
<div id="logo"><img src="https://lluisballbe.smugmug.com/Assets-for-website/i-CsMnM3R/0/Th/800x800-round-Th.png"> </div>
</div>
<div id="photography-bottom">
<a href="www.lluisballbe.smugmug.com">
<div id="photography-button">
<h1>PHOTOGRAPHY</h1>
</div>
</a>
</div>
Images to be used (each should cover 50%, can resize them and change pixel size if needed):
https://dl.dropboxusercontent.com/u/54898895/Public.rar
[Top Image][3]
[Bottom image][4]
I'd do it this way:
Add height: 50vh; to #business-top and #photography-bottom for both outter container.
Give your containers your custom background-images: background-image: url('url to image');
Make sure the images have background-size: cover;
Add your #logo-separator with position:absolute;
and top: calc( 50% - (height_of_sperator)px;

Target element outside onclick event?

I'm doing a page for someone. I toggled the visibility of a div with a checkbox however, he wants to change the height of the header which comes before the content div which has the onclick event. Could anyone help me out? either css or js/jquery.
What I want:
checkbox off: div hidden & header height 412px.
checkbox checked: div showed & header height 212px.
header {
width:100%;
height:412px;
text-align:center;
background:#1f1f1f;
margin: 0;
padding: 0;
border: 0;
position:relative;
}
#wrapper td {
vertical-align: middle;
text-align: center;
}
#wrapper td img {
position: absolute;
top: 50%;
left: 50%;
width: 736px;
height: 105px;
margin-top: -52px; /* Half the height */
margin-left: -368px; /* Half the width */
}
div.content {
background:#ebebec;
position:relative;
top:100px;
color: white;
width: 100%;
text-align: center;
font-family: BlueHighway, Arial Black, sans-serif;
top:0;
}
div.content label {
display: block;
width:80px;
height:88px;
background:url(http://i.imgur.com/Buvp49A.png) no-repeat;
background-position: center top;
margin:0 auto;
margin-bottom:30px;
}
div.content label:hover {
cursor: pointer; background-position: center bottom;
}
div.button {
display:block;
position:relative;
top:-67px;
padding-top:22px;
background:url(http://i.imgur.com/Gf3QAxt.png) no-repeat;
background-position: center top;
}
input.toggle ~ div.description {
height: 0px;
overflow: hidden;
transition: .6s all cubic-bezier(0.730, -0.485, 0.145, 1.620)
}
input.toggle:checked ~ div.description { height: 530px; }
input.toggle:checked + label { background-position: center bottom; }
input.toggle { display: none; }
<header>
<table id="wrapper">
<tr>
<td><img src="http://i.imgur.com/vE3KBOv.png" alt="Santos#imvu"/></td>
</tr>
</table>
</header>
<div class="content">
<div class="button">
<input type="checkbox" id="punch" class="toggle">
<label for="punch"></label>
<div class="description">
<img src="http://i.imgur.com/8sY0E5c.gif" style="max-width:100%;height:auto" alt="bla">
</div>
</div>
</div>
Demo
Something like this?
I've set the initial height to 212px and added a new class to CSS header.expand where you set the height to 412px. After that you trigger the click() event for the checkbox in jQuery and toggle the expand class with toggleClass(...)
SNIPPET
$('#punch').click(function() {
$('header').toggleClass('expand');
});
html {
background: grey;
font-family: Arial, Helvetica, sans-serif;
font-size: 100%;
}
body {
background: #ebebec;
width: 926px;
margin: 0 auto;
padding: 0;
color: grey;
}
header {
width: 100%;
height: 212px;
text-align: center;
background: #1f1f1f;
margin: 0;
padding: 0;
border: 0;
position: relative;
transition: height .8s ease-out;
}
header.expand {
height: 412px;
}
#wrapper td {
vertical-align: middle;
text-align: center;
}
#wrapper td img {
position: absolute;
top: 50%;
left: 50%;
width: 736px;
height: 105px;
margin-top: -52px;
/* Half the height */
margin-left: -368px;
/* Half the width */
}
.image {
width: 500px;
height: 500px;
margin: 0 auto;
position: relative;
margin-bottom: 94px;
}
footer {
width: 100%;
text-align: center;
padding: 20px 0;
font-size: 12px;
background: #1f1f1f;
margin-top: 28px;
color: #fff;
clear: both;
}
a {
color: #0082ff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
p {
width: 870px;
margin: 0 auto;
}
div.content {
background: #ebebec;
position: relative;
top: 100px;
color: white;
width: 100%;
text-align: center;
font-family: BlueHighway, Arial Black, sans-serif;
top: 0;
}
div.content label {
display: block;
width: 80px;
height: 88px;
background: url(http://i.imgur.com/Buvp49A.png) no-repeat;
background-position: center top;
margin: 0 auto;
margin-bottom: 30px;
}
div.content label:hover {
cursor: pointer;
background-position: center bottom;
}
div.button {
display: block;
position: relative;
top: -67px;
padding-top: 22px;
background: url(http://i.imgur.com/Gf3QAxt.png) no-repeat;
background-position: center top;
}
input.toggle ~ div.description {
height: 0px;
overflow: hidden;
transition: .6s all cubic-bezier(0.730, -0.485, 0.145, 1.620)
}
input.toggle:checked ~ div.description {
height: 530px;
}
input.toggle:checked + label {
background-position: center bottom;
}
input.toggle {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<header>
<table id="wrapper">
<tr>
<td>
<img src="http://i.imgur.com/vE3KBOv.png" alt="Santos#imvu" />
</td>
</tr>
</table>
</header>
<div class="content">
<div class="button">
<input type="checkbox" id="punch" class="toggle">
<label for="punch"></label>
<div class="description">
<img src="http://i.imgur.com/8sY0E5c.gif" style="max-width:100%;height:auto" alt="bla">
</div>
</div>
</div>