I want to wrap text around image as shown below:
How can I do it?...
I would be very grateful for the information. Thanks to all.
You can make use of the position: absolute inside a relatively positioned container and use the top and left properties to align it.
.img-circle-wrap {
position: relative;
width: 500px;
height: 500px;
}
.img-circle {
position: absolute;
left: 30%;
top: 30%;
}
.img-circle-wrap span {
position: absolute;
}
.text-1 {
top: 20%;
left: 20%;
}
.text-2 {
top: 20%;
left: 70%;
}
.text-3 {
top: 50%;
left: 10%;
}
.text-4 {
top: 50%;
left: 80%;
}
.text-5 {
top: 80%;
left: 20%;
}
.text-6 {
top: 80%;
left: 70%;
}
.text-7 {
top: 20%;
left: 45%;
}
.text-8 {
top: 80%;
left: 45%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="img-circle-wrap">
<img src="http://placehold.it/200x200" alt="..." class="img-circle">
<span class="text-1">Text 1</span>
<span class="text-2">Text 2</span>
<span class="text-3">Text 3</span>
<span class="text-4">Text 4</span>
<span class="text-5">Text 5</span>
<span class="text-6">Text 6</span>
<span class="text-7">Text 7</span>
<span class="text-8">Text 8</span>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12">
<div class="col-sm-6">
Text here
</div>
<div class="col-sm-6">
Text here
</div>
<div class="col-sm-3">
Text here
</div>
<div class="col-sm-6">
<img src="img.jpg" class="img-responsive"/>
</div>
<div class="col-sm-3">
Text here
</div>
<div class="col-sm-6">
Text here
</div>
<div class="col-sm-6">
Text here
</div>
<div class="col-sm-6">
Text here
</div>
<div class="col-sm-6">
Text here
</div> `enter code here`
</div>
</div>
</div>
Related
I have a modal album which shows images with different sizes. My pbolem is that how to style the navigation arrows, so that they appear at the middle of the page, no matter what is the size of the image. Here is my code:
<div class="row img-box">
<div class="col-1">
<span #click="nextImg(-1)" class="nav-arrow">❮</span>
</div>
<div class="col-9">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" :src=" getImgUrl(currentMediaUrl)">
</div>
<div class="col-1">
<span #click="nextImg(1)" class="nav-arrow">❯</span>
</div>
</div>
And here is the relevant css:
.modal-img {
max-height: 1080px;
}
.img-box {
display: flex;
align-items:center;
}
.nav-arrow {
font-size: 3em;
position: absolute;
top: 50%;
}
But whatever I tweak the CSS can not get the desired effect. Hence the question.
Use position fixed
.modal-img {
max-height: 1080px;
}
.img-box {
display: flex;
align-items:center;
justify-content: center;
}
.nav-arrow {
font-size: 3em;
position: fixed;
top: 120px;
}
.nav-left {
left: 10px;
}
.nav-right {
right: 10px;
}
<div class="row img-box">
<div class="col-1">
<span #click="nextImg(-1)" class="nav-arrow nav-left">❮</span>
</div>
<div class="col-9">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" src="https://via.placeholder.com/500C/O https://placeholder.com/">
</div>
<div class="col-1">
<span #click="nextImg(1)" class="nav-arrow nav-right">❯</span>
</div>
</div>
you need to apply transform: translateY(-50%) on arrow container's, in order to put the arrows in the center.
.nav-arrow {
font-size: 3em;
position: absolute;
top: 50%;
transform: translateY(-50%)
}
or simply, remove position: absolute; top: 50%;
Does this works for you? I have added the bootstrap class align-items-center and some padding to spans
.modal-img {
max-height: 1080px;
}
.nav-arrow {
font-size: 3em;
position: relative;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row img-box align-items-center">
<div class="col-1 ">
<span #click="nextImg(-1)" class="nav-arrow pt-5 d-inline-block">❮</span>
</div>
<div class="col-9 text-center">
<h1>Modal comes here</h1>
<img class="img-fluid modal-img" src="https://via.placeholder.com/100/O https://placeholder.com/">
</div>
<div class="col-1">
<span #click="nextImg(1)" class="nav-arrow pt-5 d-inline-block">❯</span>
</div>
</div>
I am working on a personal design project where I have 5 tiles with images in them and when you mouse over any of them they display alternate text. I have included my source code but my problem seems to be when I test this by hovering over the tile I added the W3 snippet to nothing happens. If I inspect the code however and add the hover attribute in the Chrome inspect tool it seems to work just fine. What am I missing here?
Here is my code My Code
.bottom p {
text-align: center;
}
.bottom {
margin-top: 200px;
width: 50%;
}
.top {
width: 33.33333333333%;
display: inline-block;
}
.tile {
height: 200px;
justify-content: center;
align-items: center;
overflow: hidden;
padding-left: 0px;
padding-right: 0px;
border-style: solid;
border-width: 5px;
border-color: /*Navy Blue*/ #333333/* FetchMe Orange #FBAA1E*/;
text-align: center;
box-shadow: 5px 5px 10px #000000;
}
.tile p {
z-index: 4;
font-size: 24px;
position: absolute;
bottom: 0;
margin-bottom: 10px;
font-weight: bold;
text-align: center;
margin-left: 35%;
margin-right: 35%;
}
.img1 {
flex-shrink: 0;
min-width: 100%;
min-height: 100%
}
.top p {
text-align: center;
}
.fetch-form {
padding-top: 50px;
padding-bottom: 50px;
margin: 0 auto;
position: absolute;
z-index: 3;
margin-left: 110px;
margin-right: 110px;
left: 0;
right: 0;
}
.tiles {
margin-left: 0px;
margin-right: 0px;
z-index: 2;
position: absolute;
top: 150px;
left: 0px;
color: white;
display: inline-block;
padding-top: 10px;
}
.inner {
display: block;
margin-left: auto;
margin-right: auto;
}
.slider {
z-index: -1;
position: absolute;
padding-right: 0;
padding-left: 0;
margin-right: 0;
margin-left: 0;
left: 0;
right: 0;
top: 0;
height: 600px;
min-width: 100%;
}
.item {
height: 600px;
}
.container {
position: relative;
}
.overlay {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background-color: #008CBA;
overflow: hidden;
width: 0%;
height: 100%;
transition: .5s ease;
z-index: 5;
}
.container:hover .overlay {
width: 100%;
}
.text {
white-space: nowrap;
color: white;
font-size: 20px;
position: absolute;
overflow: hidden;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
}
.image {
display: block;
width: 100%;
height: auto;
}
<div class="row">
<div class="col-xs-10 fetch-form">
<form action="order" method="POST" role="form" id="address_form">
<div class="col-xs-12 fetch-form">
<div class="row">
<div class="col-xs-8 input">
<div class="input">
<i class="icon-prepend fa fa-home"></i>
<input type="text" placeholder="Street Address (optional)" id="address" name="address" class="form-control input-lg" autocomplete="off">
</div>
</div>
<div class="col-xs-2">
<input type="hidden" name="zip_code"><input type="hidden" value="true" name="set_temp_address">
<button class="btn btn-primary btn-lg btn-block btn" type="submit">
<i class="fa fa-search"></i> Fetch Me Food!
</button>
</div>
</div>
</div>
<div class="row well well-sm" style="display: none;">
<div class="col-xs-4 text-center">
<div class="radio" >
<label><center><i class="fa fa-taxi fa-lg hidden-xs"> </i></center>
<input type="radio" id="type_delivery" name="order_type" value="DELIVERY" checked="checked">
<span class="radiosearch"> </span><span class="ordertype">Delivery</span>
</label>
</div>
</div>
<div class="col-xs-4 text-center border-left">
<div class="radio">
<label>
<center><i class="fa fa-cutlery fa-lg hidden-xs"> </i></center>
<input type="radio" id="type_takeout" name="order_type" value="TAKEOUT">
<span class="radiosearch"> </span>
<span class="ordertype"><nobr>Pick-up</nobr></span>
<nobr></nobr>
</label>
</div>
</div>
<div class="col-xs-4 text-center border-left" >
<div class="radio"><a href="/account/groups" style="color: #333333;">
<label>
<center><i class="fa fa-group fa-lg" style="margin-bottom: 6px;"> </i></center>
<span class="ordertype"><span style="margin-top:9px;" class="visible-xs">Group »</span></span> <span
class="ordertype"><span class="hidden-xs">Group Order »</span></span> </label></a></div>
</div>
</div>
</form>
</div>
<div class="col-xs-12 tiles">
<div class="inner">
<div class="col-xs-3 top tile container">
<p>Restarunts and Catering</p>
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" class="img1 image" alt="">
<div class="overlay">
<div class="text">Hello World</div>
</div>
</div>
</div>
<div class="col-xs-3 top tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" class="img1" alt="">
<p>Our Deals</p>
</div>
<div class="col-xs-3 top tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" class="img1" alt="">
<p>Grocery Shopping</p>
</div>
</div>
</div>
<br>
<div class="col-xs-12 tiles">
<div class="inner">
<div class="col-xs-6 bottom tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" alt="" class="img1" >
<p>Tailgates</p>
</div>
<div class="col-xs-6 bottom tile">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/fruits-grocery-bananas-market.jpg" alt="" class="img1">
<p>Order Anything</p>
</div>
</div>
</div>
<div class="slider col-xs-12">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<!-- Slide one -->
<div class="item active">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download.jpg" alt="">
</div>
<!-- Slide two -->
<div class="item">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download.jpg" alt="">
</div>
<!--Slide three -->
<div class="item">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download+(2).jpg" alt="">
</div>
<!--Slide four -->
<div class="item">
<img src="https://s3.amazonaws.com/fetchme-prototype/images/download+(2).jpg" alt="">
</div>
</div>
</div>
</div>
</div>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
This is an issue with other tiles overlapping the containers (z-index issue). You can try something like this:
.tiles {
pointer-events: none;
}
.container {
pointer-events: auto;
}
It is because you have used .tiles class for both .col-xs-12 items which are supposed to be 2 rows of pictures.
.tiles class has top, left properties defined and are position property as absolute. Since both rows of pictures have same top and left positions from .tiles, the second one overlaps the first.
This is why hover will never happen for .container normally. hover is always happening for the second row which is on top even though 1st row is visible below.
I have been trying to align four images that are to be displayed as the pic below. But I have been getting spaces after each row. How can I remove them?
Also is there a way that I can add a small thumbnail of the example image in the middle where all four images meet?
Along with this I am also trying to add captions over the images. Currently they are displayed below the images. How can I add them over the images?
<!DOCTYPE html>
<html>
<body alink="ff0000" bgcolor="ffffff" link="0000ff" text="000000" vlink="800080">
<div>
<div class="transbox" style="width: 50%; height=50%; float: left;">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" width="100%" />
<div style="position: relative; top:50%; left:45%; width:200px; height:25px">
<center>
<font color="Black" size="+2">Looking Into The Future</font>
</center>
</div>
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" width="100%" />
<div style=" text-align: center; vertical-align: middle;">
<center>
<font color="Black" size="+2">correct one</font>
</center>
</div>
</div>
</div>
<div>
<div class="transbox" style="width: 50%; height=50%; float: right;">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" width="100%" />
<div style="position: relative; top:50%; left:45%; width:200px; height:25px">
<center>
<font color="Black" size="+2">Looking Into The Future</font>
</center>
</div>
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" width="100%" />
<div style="position: relative; top:50%; left:45%; width:200px; height:25px">
<center>
<font color="Black" size="+2">Looking Into The Future</font>
</center>
</div>
</div>
</div>
</div></body>
</html>
JSFiddle link:
https://jsfiddle.net/8bL4qqr8/
body{
background-color:"ffffff";
}
.img-grid{
width: 50%;
float:left;
height:400px;
}
.img-grid img{
width :100%;
height:400px;
}
.caption{
display :none;
}
.img-grid:hover .caption{
text-align: center;
display:block;
background: #000;
color: #fff;
font-size:16px;
font-weight: bold;
margin-top: -100px;
padding: 10px;
}
<div class="transbox img-grid">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" />
<div class="caption">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox img-grid">
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" />
<div class="caption">
<p>Looking into the future</p>
</div>
</div>
<div class="transbox img-grid">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" />
<div class="caption">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox img-grid">
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" />
<div class="caption">
<p>Looking Into The Future</p>
</div>
</div>
You have a lot of deprecated stuff in your HTML. Don't use all this link, text stuff in your body. And not <center> or <font> otherwise. I made a simple snippet of the stuff your wanted with flexbox. I modified your code a bit. You can find browser support for flexbox here: http://caniuse.com/#search=flexbox
body {
margin: 0;
padding: 0;
background-color: #FFFFFF;
}
* {
box-sizing: border-box;
}
.wrapper {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;
flex-direction: row;
}
.transbox {
position: relative;
flex: 1 0 50%;
width: 50%;
margin: 0;
padding: 0;
}
.transbox .thumbnail {
display: block;
position: absolute;
width: 100px;
height: 75px;
}
.transbox:nth-of-type(1) .thumbnail {
bottom: 0;
right: 0;
}
.transbox:nth-of-type(2) .thumbnail {
bottom: 0;
left: 0;
}
.transbox:nth-of-type(3) .thumbnail {
top: 0;
right: 0;
}
.transbox:nth-of-type(4) .thumbnail {
top: 0;
left: 0;
}
.transbox img {
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
float: left;
margin: 0;
padding: 0;
border: 0;
}
.transbox .text {
position: absolute;
width: 100%;
text-align: center;
color: #FFFFFF;
}
<div class="wrapper">
<div class="transbox">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" />
<div class="thumbnail">
<img src="https://s22.postimg.org/61txkvgch/Venture_Capital.jpg" />
</div>
<div class="text">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox">
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" />
<div class="thumbnail">
<img src="https://s11.postimg.org/zf842w1mb/Real_Estate.jpg" />
</div>
<div class="text">
<p>Looking into the future</p>
</div>
</div>
<div class="transbox">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" />
<div class="thumbnail">
<img src="https://s18.postimg.org/acomst9gp/image.jpg" />
</div>
<div class="text">
<p>Looking Into The Future</p>
</div>
</div>
<div class="transbox">
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" />
<div class="thumbnail">
<img src="https://s13.postimg.org/8yima8xvb/Construction.jpg" />
</div>
<div class="text">
<p>Looking Into The Future</p>
</div>
</div>
</div>
Hope this is what you were looking for
<!DOCTYPE html>
<html >
<head>
<style type="text/css">
* {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0;
padding: 0;
}
.item {
position: relative;
float: left;
border: 1px solid #333;
overflow: hidden;
width: 50%;
height: 50%
}
.item img {
max-width: 100%;
-moz-transition: all 0.3s;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.item:hover img {
-moz-transform: scale(1.1);
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
h1 {
color: white;
margin: 0;
padding: 20px;
}
html, body { height: 100%; padding: 0; margin: 0; }
</style>
</head>
<body>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<div class="grow" style=" width: 40%; position: fixed; top: 50%; left: 50%; margin-top: -100px; margin-left: -10%;">
<div>
<img class=" align:center"; src="https://s14.postimg.org/6ufixiest/Logo.jpg" width="100%" />
</div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/IT-1.jpg" alt="pepsi">
<div class="item-overlay top"></div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/RealEstate1.jpg" alt="pepsi" >
<div class="item-overlay top"></div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/VentureCapital-1.jpg" alt="pepsi" >
<div class="item-overlay top"></div>
</div>
<div class="item">
<img src="http://vindhyaassociates.com/wp-content/uploads/2016/09/Construction-1.jpg" alt="pepsi" >
<div class="item-overlay top"></div>
</div>
<div style=" width: 20%; position: fixed; top: 25%; left: 25%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Construction/Interior Design - Build to Live
</h1>
</div>
</div>
<div style=" width: 20%; position: fixed; top: 25%; left: 75%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Real Estate - Buy and Sell Potential Properties
</h1>
</div>
</div>
<div style=" width: 20%; position: fixed; top: 75%; left: 25%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Information Technology - Handling Potential IT Projects
</h1>
</div>
</div>
<div style=" width: 20%; position: fixed; top: 75%; left: 75%; margin-top: -100px; margin-left: -10%;">
<div>
<h1 id="text">
Venture Capital - Finance for High Growth Potential
</h1>
</div>
</div>
<div class="grow" style=" width: 20%; position: fixed; top: 50%; left: 50%; margin-top: -100px; margin-left: -10%;">
<div>
<img class=" align:center"; src="https://s14.postimg.org/6ufixiest/Logo.jpg" width="100%" />
</div>
</div>
</body>
</html>
I do not know why my left is not working on image.
it's not working if i try with #new_index_body_slide_image_2, nor with #new_index_body_slide_image_2 img
Here is my code:
#index_content {
position: absolute;
top: 200px;
}
#new_index_body_slide_image_2 {
position: absolute;
left: 30px; //not working
}
<div id="body" style="height:600px">
<div id="index_content">
<div id="index_content_slide">
<div id="new_index_body_slide_image_1">
<img src="images/content_img/kuca2.jpg">
</div>
<div id="new_index_body_slide_image_2">
<img src="images/content_img/new_gips.jpg">
</div>
</div>
<button onclick="test()">Click me</button>
</div>
</div>
It's working absolutely fine. By default div's will be rendered as block, so the second image will be positioned on the next line and 30px away from the left.
Explanation for the issue:
#index_content {
position: absolute;
top: 200px;
}
#new_index_body_slide_image_2 {
position: absolute;
left: 30px; //not working
}
img {
border: 1px solid red;
}
<div id="body" style="height:600px">
<div id="index_content">
<div id="index_content_slide">
<div id="new_index_body_slide_image_1">
<img src="http://i.imgur.com/8MqehqH.png">
</div>
<div id="new_index_body_slide_image_2">
<img src="http://i.imgur.com/pNgIqxQ.png">
</div>
</div>
<button onclick="test()">Click me</button>
</div>
</div>
In case you wish to position the images next to each other(on the same row). Try top: 0 on the second image.
Positioning image side by side:
#index_content {
position: absolute;
top: 200px;
}
#new_index_body_slide_image_2 {
position: absolute;
top: 0;
left: 30px;
/* not working */
}
img {
border: 1px solid red;
}
<div id="body" style="height:600px">
<div id="index_content">
<div id="index_content_slide">
<div id="new_index_body_slide_image_1">
<img src="http://i.imgur.com/8MqehqH.png">
</div>
<div id="new_index_body_slide_image_2">
<img src="http://i.imgur.com/pNgIqxQ.png">
</div>
</div>
<button onclick="test()">Click me</button>
</div>
</div>
change it to position:relative
How would I make it so the banners along the top and bottom of this page (http://i.imgur.com/SxjbCJV.jpg) are instead at both sides of the page?
I currently have them both fixed to the top and bottom of the page:
#header {
position: fixed;
top: 0;
width: 100%;
height: 66px;
z-index: 999;
}
#footer {
position: fixed;
bottom: 0;
width: 100%;
height: 66px;
z-index: 999;
}
And the HTML:
<body>
<div id="wrapper">
<a href="project.html">
<div id="header">
<button id="next-button" href="project.html"><i class="fa fa-arrow-circle-right fa-4x"></i>
</button>
</div>
</a>
<div id="main">
<div id="splash">
<div id="name">
<h1 class="wow animated flipInX">Max Wilson</h1>
</div>
<div id="profile">
<img src="img/Logo.png" class="wow animated rollIn" data-wow-delay="1s">
</div>
<div id="subtext">
<h2 class="wow animated fadeInUp" data-wow-delay="2s">Aspiring Developer </h2>
</div>
</div>
</div>
</div>
<a href="project.html">
<div id="footer">
<button id="prev-button" href="project.html"><i class="fa fa-arrow-circle-left fa-4x"></i>
</button>
</div>
</a>
Have you tried floating the header and footer to the left?
For example:
#header {
position: relative;
float: left;
width: 50px;
height: 500px;
background-color: #44f;
}
#footer {
position: relative;
float: left;
width: 50px;
height: 500px;
background-color: #44f;
}
#wrapper{ text-align: center;
margin-left: auto;
margin-right: auto;
}
#main{ width: 800px;
float:left;
}
Here's a simple and interesting method: giving the body display: flex and the content flex-grow: 1 so it occupies all the available space and pins the other elements to either side.
<div class="side">
<h3>asdf</h3>
<h3>asdf</h3>
<h3>asdf</h3>
<h3>asdf</h3>
</div>
<div id="content">
<p>asdfasdf</p>
</div>
<div class="side">
<h3>asdf</h3>
<h3>asdf</h3>
<h3>asdf</h3>
<h3>asdf</h3>
</div>
body {
display: flex;
}
.side, #content {
padding: 10px;
}
.side {
background: blue;
}
#content {
flex-grow: 1;
background: grey;
}
https://jsfiddle.net/JackHasaKeyboard/rz86xwxh/2/