<div class="container">
<div class="row content">
<div class="col-sm-1 sidenav" style="background-color:blue">
</div>
<div class="col-sm-2" style="background-color:orange">
<div align="center" style="background-color:pink">
<img class="img-circle" src="http://placehold.it/100x100" style="padding-top:10px;">
<h3>JOHN</h3>
</div>
<div class="navbar-default" role="navigation" style="background-color:purple">
<ul class="nav" id="side-menu">
<li>Profile</li>
<li>Published</li>
<li>Bookmarked</li>
</ul>
</div>
</div>
<div class="col-sm-8" style="background-color:yellow">
<h3>Personal Information</h3>
<table id="personal-information" class="table" align="left">
<tbody>
<tr>
<td>Joined:</td>
<td>2018-02-10</td>
</tr>
<tr>
<td>Last Active:</td>
<td>2019-10-15 12:15:17</td>
</tr>
<tr>
<td>Gender:</td>
<td>MALE</td>
</tr>
<tr>
<td>Age:</td>
<td>26</td>
</tr>
<tr>
<td>About me:</td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-sm-1 sidenav" style="background-color:blue" >
</div>
</div>
</body>
view
I cleaned it up as much as possible. I also added colors to each div so it's clear to see.
I divided up my page into 4. 2 of them called sidenavs to create spaces on both sides to center view my main content, 1 is for the user image, name and nav buttons and the other one is for other content like personal info and will probably add more. So i divided them respectively: 1 - 2 -8 - 1
My problem is that, i don't understand the current alignment of my columns, As you can see from the image, side nav blue which should be at the right edge is now at the bottom. I made sure that all my columns sizes add up to 12 which is the maximum so i don't know why the other div is pushed down to the next row.
P.S. all those weird html names like sidenav even though it's not a navigation bar which is on the side. And the row content with an already div container. I copy pasted whole html page code from free bootstrap template(you can actually see the resemblance if you downloaded some of them - i'm not good at deciding how to design my pages so i just decided to pick from a template and tweak it however i want)
Is this how it's meant to look?
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<div class="container">
<div class="row content">
<div class="col-sm-1 sidenav" style="background-color:blue">
</div>
<div class="col-sm-2" style="background-color:orange">
<div align="center" style="background-color:pink">
<img class="img-circle" src="http://placehold.it/100x100" style="padding-top:10px;">
<h3>JOHN</h3>
</div>
<div class="navbar-default" role="navigation" style="background-color:purple">
<ul class="nav" id="side-menu">
<li>Profile</li>
<li>Published</li>
<li>Bookmarked</li>
</ul>
</div>
</div>
<div class="col-sm-8" style="background-color:yellow">
<h3>Personal Information</h3>
<table id="personal-information" class="table" align="left">
<tbody>
<tr>
<td>Joined:</td>
<td>2018-02-10</td>
</tr>
<tr>
<td>Last Active:</td>
<td>2019-10-15 12:15:17</td>
</tr>
<tr>
<td>Gender:</td>
<td>MALE</td>
</tr>
<tr>
<td>Age:</td>
<td>26</td>
</tr>
<tr>
<td>About me:</td>
<td></td>
</tr>
</tbody>
</table>
</div>
<div class="col-sm-1 sidenav" style="background-color:blue">
</div>
</div>
</div>
If so, you had
<div class="col-sm-1 sidenav" style="background-color:blue"></div>
Outside of
<div class="row content"></div>
See here: JSFiddle
Related
I am trying to expand/collapse the following row if row with class='sector' is clicked
This same code seems to work for many people as per other stackoverflow answers but it is not working for me and I wonder why? I do not know much jquery but this seems to me to be workable but still does not work.
Kindly give a simple solution
$(document).ready(function() {
$("td[colspan=2]").hide();
$("tr.sector").click(function() {
$(this).next().toggle();
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="table-responsive">
<table class="table">
<tr>
<td scope="col">Sector</th>
<td scope="col">Total Qty</th>
</tr>
<tr class="sector">
<td>Sector no. 2</td>
<td>
M : 1, </td>
</tr>
<tr>
<td colspan="2">
<p>
<div>
<div class="row">
<div class="col-4">Plot no. 5 | NPSC Apartment</div>
<div class="col-4">1 Packets</div>
<div class="col-4">Details</div>
</div>
</div>
</p>
</td>
</tr>
<tr class="sector">
<td>Sector no. 3</td>
<td>
M : 2, MJ : 1, </td>
</tr>
<tr>
<td colspan="2">
<p>
<div>
<div class="row">
<div class="col-4">Plot no. 1 | Heritage Tower (Sawan CGHS)</div>
<div class="col-4">1 Packets</div>
<div class="col-4">Details</div>
</div>
<div class="row">
<div class="col-4">Plot no. 8 | Himachali Apartment</div>
<div class="col-4">2 Packets</div>
<div class="col-4">Details</div>
</div>
</div>
</p>
</td>
</tr>
</table>
</div>
</div>
You are hiding the td[colspan=2] inside tr and trying to toggle that same tr without actuality showing the td you have hidden in first place.
So you need to use next to get next tr sibling and find inside td[colspan=2] you have hidden and toggle that.
Please read documentation on Jquery Tree Traversal and next time watch for your HTML tree. Its all well documented and explained on link provided.
$(document).ready(function() {
$("tr > td[colspan=2]").hide();
$("tr.sector").click(function() {
$(this).next().find("td[colspan=2]").toggle();
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="table-responsive">
<table class="table">
<tr>
<td scope="col">Sector</th>
<td scope="col">Total Qty</th>
</tr>
<tr class="sector">
<td>Sector no. 2</td>
<td>
M : 1, </td>
</tr>
<tr>
<td colspan="2">
<p>
<div>
<div class="row">
<div class="col-4">Plot no. 5 | NPSC Apartment</div>
<div class="col-4">1 Packets</div>
<div class="col-4">Details</div>
</div>
</div>
</p>
</td>
</tr>
<tr class="sector">
<td>Sector no. 3</td>
<td>
M : 2, MJ : 1, </td>
</tr>
<tr>
<td colspan="2">
<p>
<div>
<div class="row">
<div class="col-4">Plot no. 1 | Heritage Tower (Sawan CGHS)</div>
<div class="col-4">1 Packets</div>
<div class="col-4">Details</div>
</div>
<div class="row">
<div class="col-4">Plot no. 8 | Himachali Apartment</div>
<div class="col-4">2 Packets</div>
<div class="col-4">Details</div>
</div>
</div>
</p>
</td>
</tr>
</table>
</div>
</div>
I am using the GetSkeleton CSS framework to build my website and I've broken it down in currently 3 sections. I have my header which contains my navigation and a logo. Then underneath I have my main content which is split into 2, as Skeleton uses columns I have a sidebar which is two columns and my main section is ten columns. How can I stretch my sidebar and main section to 100% height? I don't want any footers or anything, just 100% height from those sections?
Example of Website
Above is a screen shot of my website so far, so you can see I want that red and blue to stretch right to the bottom of the website.
This is the framework I'm using: http://getskeleton.com
And here is my HTML code;
<!-- Primary Page Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="container u-full-width">
<div style="padding: 10px;">
<div class="row">
<!-- Navigation Bar -->
<div class="twelve columns">
<?php include 'includes/navbar.php'; ?>
</div>
</div>
<div class="row" style="padding-top: 5%;">
<!-- Side Bar -->
<div class="two columns link-coloured" style="background-color: blue;">
<h2>Customers</h2>
<hr>
<br /><br />
<h5>Live Leads (3)</h5>
<h5>Action Required <span style="color: red;">(5)</span></h5>
<h5>Notifications <span style="color: orange;">(2)</span></h5>
<h5>New Leads <span style="color: green;">(11)</span></h5>
</div>
<!-- Main Content Section -->
<div class="ten columns" style="background-color: red;">
<h1>Live Leads</h1>
<hr>
<button class="button-primary">Add New Lead</button>
<br /><br />
<table>
<tr>
<th>Customer Name</th>
<th>Date Added</th>
<th>Status</th>
</tr>
<tr>
<td>Name 2</td>
<td>08/09/2019</td>
<td><span style="color: green">Vehicle Sold</span></td>
</tr>
<tr>
<td>Name 3</td>
<td>09/07/2019</td>
<td><span style="color: blue">Prospect</span></td>
</tr>
<tr>
<td>name 4</td>
<td>10/07/2019</td>
<td><span style="color: red">Archived</span></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
I think This will be working fine
<!DOCTYPE html>
<html>
<head>
<title>tt</title>
<link rel="stylesheet" type="text/css" href="skeleton.css">
</head>
<body>
<div style="padding: 10px;">
<div class="row">
<!-- Navigation Bar -->
<div class="twelve columns">
<?php include 'includes/navbar.php'; ?>
</div>
</div>
<div class="row" style="padding-top: 5%; ">
<!-- Side Bar -->
<div class="two columns link-coloured" style="background-color: blue; height: calc(100vh - 140px)">
<h2>Customers</h2>
<hr>
<br /><br />
<h5>Live Leads (3)</h5>
<h5>Action Required <span style="color: red;">(5)</span></h5>
<h5>Notifications <span style="color: orange;">(2)</span></h5>
<h5>New Leads <span style="color: green;">(11)</span></h5>
</div>
<!-- Main Content Section -->
<div class="ten columns" style="background-color: red;height: calc(100vh - 140px)">
<h1>Live Leads</h1>
<hr>
<button class="button-primary">Add New Lead</button>
<br /><br />
<table>
<tr>
<th>Customer Name</th>
<th>Date Added</th>
<th>Status</th>
</tr>
<tr>
<td>Name 2</td>
<td>08/09/2019</td>
<td><span style="color: green">Vehicle Sold</span></td>
</tr>
<tr>
<td>Name 3</td>
<td>09/07/2019</td>
<td><span style="color: blue">Prospect</span></td>
</tr>
<tr>
<td>name 4</td>
<td>10/07/2019</td>
<td><span style="color: red">Archived</span></td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html>
So I have a row with 2 columns. One column has 2 cards in it while the other column has 1 card in it. The content of the second card and the third card are dynamic.
Is there a way using css to have the cards auto set the height so that the bottom of the cards line up? When the card called "secondPanel" has less content than the card called "thirdPanel" I'd like the height on secondPanel to be increased so that the bottom of it lines up with the bottom of thirdPanel and when thirdPanel is smaller than secondPanel for thirdPanel's height to be increased so that the bottom of it lines up with the bottom of secondPanel.
I've tried using the boostrap h-100 classes to get this to work but overall height of the parent containers are never set anywhere so that class doesn't seem to do anything. I know I can accomplish this using javascript to compare the heights and set it that way but I'd like to do it with pure CSS or existing bootstrap functionality if possible.
<div class="container">
<div class="row">
<div class="col">
<div class="card" id="firstPanel">
<div class="card-body">
<h3 class="card-title">Here's the 1st panel</h3>
<div class="card-text">We'll add a little text to fill out the height of the card a little bit</div>
</div>
</div>
<div class="card" id="secondPanel">
<div class="card-body">
<h3 class="card-title">Here's the 2nd panel</h3>
<div class="card-text">Sed ut perspiciatis unde omnis iste natus error sit voluptatem"</div>
</div>
</div>
</div>
<div class="col">
<div class="card" id="thirdPanel">
<div class="card-header card-title">
<div class="row">
<div class="col">
Results
</div>
</div>
</div>
<div class="card-body">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<tr class="result-summary-row">
<td>Smith, Robert</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>Jones, Ralph</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>Jefferson, Julio</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>Brauman, Derrick</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>James, Henry</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
In your case you should encapsulate the two panel in a flex div then make the second panel fill the rest of the parent using flex: 1, hope it will help
#secondPanel {
flex:1;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col">
<div class="d-flex flex-column h-100">
<div class="card" id="firstPanel">
<div class="card-body">
<h3 class="card-title">Here's the 1st panel</h3>
<div class="card-text">We'll add a little text to fill out the height of the card a little bit</div>
</div>
</div>
<div class="card" id="secondPanel">
<div class="card-body">
<h3 class="card-title">Here's the 2nd panel</h3>
<div class="card-text">Sed ut perspiciatis unde omnis iste natus error sit voluptatem"</div>
</div>
</div>
</div>
</div>
<div class="col">
<div class="card h-100" id="thirdPanel">
<div class="card-header card-title">
<div class="row">
<div class="col">
Results
</div>
</div>
</div>
<div class="card-body">
<table class="table table-striped table-hover">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
<tr class="result-summary-row">
<td>Smith, Robert</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>Jones, Ralph</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>Jefferson, Julio</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>Brauman, Derrick</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
<tr class="result-summary-row">
<td>James, Henry</td>
<td>Report Ready</td>
<td>
<span> View Report</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
My web page has a table and for one element i have to apply grid property of foundation. I have to divide the row into two columns having size 10 and 2. First column is an input field and second is a drop down icon, But when I try to do it 2nd column is going down after first column.
<table class="inner-table">
<tr>
<td width="20">plan </td>
<td width="50">Mobile</td>
<td width="15">20%</td>
<td width="15">50%</td>
</tr>
<tr>
<td>dsffgh</td>
<td>Mobile</td>
<td>20%</td>
<td>50%</td>
</tr>
<tr>
<td>Plan</td>
<td>
<div class="row">
<form class="project-name">
<div class="small-11 columns">
<input type="text" name="projectName">
</div>
<div class="small-1 columns">
<a href="#" data-dropdown="drop1"><img src="images/Rectangle-13.png" alt="dropdown-menu" height="10em" width="10em">
</a>
<ul id="drop1" class="f-dropdown" data-dropdown-content>
<li>10</li>
<li>15<li>
<li>20</li>
</ul>
</div>
</form>
</div>
</td>
</tr>
<tr>
<td id="dot-emp3" class="show-more">
...
</td>
</tr>
</table>
http://codepen.io/anon/pen/MaaOxG
I'm creating a grid system on a page layout by following the documentation.
My layout causes misalignment when using a grid system with sidebar. The two <div> inside the row are not aligned and appears with a page break. I've playing with col and offset values with no success.
DEMO in Bootply
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active">Overview</li>
<li>Reports</li>
<li>Analytics</li>
<li>Export</li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Dashboard</h1>
<div class="row placeholders">
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/sky" class="img-responsive" alt="200x200" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iIzBEOEZEQiI+PC9yZWN0Pjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjEwMCIgeT0iMTAwIiBzdHlsZT0iZmlsbDojZmZmO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjEzcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+MjAweDIwMDwvdGV4dD48L3N2Zz4=">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/vine" class="img-responsive" alt="200x200" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iIzM5REJBQyI+PC9yZWN0Pjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjEwMCIgeT0iMTAwIiBzdHlsZT0iZmlsbDojMUUyOTJDO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjEzcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+MjAweDIwMDwvdGV4dD48L3N2Zz4=">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/sky" class="img-responsive" alt="200x200" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iIzBEOEZEQiI+PC9yZWN0Pjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjEwMCIgeT0iMTAwIiBzdHlsZT0iZmlsbDojZmZmO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjEzcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+MjAweDIwMDwvdGV4dD48L3N2Zz4=">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
<div class="col-xs-6 col-sm-3 placeholder">
<img data-src="holder.js/200x200/auto/vine" class="img-responsive" alt="200x200" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIj48cmVjdCB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgZmlsbD0iIzM5REJBQyI+PC9yZWN0Pjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjEwMCIgeT0iMTAwIiBzdHlsZT0iZmlsbDojMUUyOTJDO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjEzcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+MjAweDIwMDwvdGV4dD48L3N2Zz4=">
<h4>Label</h4>
<span class="text-muted">Something else</span>
</div>
</div>
<h2 class="sub-header">Section title</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>#</th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
<th>Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>1,001</td>
<td>Lorem</td>
<td>ipsum</td>
<td>dolor</td>
<td>sit</td>
</tr>
<tr>
<td>1,002</td>
<td>amet</td>
<td>consectetur</td>
<td>adipiscing</td>
<td>elit</td>
</tr>
<tr>
<td>1,003</td>
<td>Integer</td>
<td>nec</td>
<td>odio</td>
<td>Praesent</td>
</tr>
<tr>
<td>1,003</td>
<td>libero</td>
<td>Sed</td>
<td>cursus</td>
<td>ante</td>
</tr>
<tr>
<td>1,004</td>
<td>dapibus</td>
<td>diam</td>
<td>Sed</td>
<td>nisi</td>
</tr>
<tr>
<td>1,005</td>
<td>Nulla</td>
<td>quis</td>
<td>sem</td>
<td>at</td>
</tr>
<tr>
<td>1,006</td>
<td>nibh</td>
<td>elementum</td>
<td>imperdiet</td>
<td>Duis</td>
</tr>
<tr>
<td>1,007</td>
<td>sagittis</td>
<td>ipsum</td>
<td>Praesent</td>
<td>mauris</td>
</tr>
<tr>
<td>1,008</td>
<td>Fusce</td>
<td>nec</td>
<td>tellus</td>
<td>sed</td>
</tr>
<tr>
<td>1,009</td>
<td>augue</td>
<td>semper</td>
<td>porta</td>
<td>Mauris</td>
</tr>
<tr>
<td>1,010</td>
<td>massa</td>
<td>Vestibulum</td>
<td>lacinia</td>
<td>arcu</td>
</tr>
<tr>
<td>1,011</td>
<td>eget</td>
<td>nulla</td>
<td>Class</td>
<td>aptent</td>
</tr>
<tr>
<td>1,012</td>
<td>taciti</td>
<td>sociosqu</td>
<td>ad</td>
<td>litora</td>
</tr>
<tr>
<td>1,013</td>
<td>torquent</td>
<td>per</td>
<td>conubia</td>
<td>nostra</td>
</tr>
<tr>
<td>1,014</td>
<td>per</td>
<td>inceptos</td>
<td>himenaeos</td>
<td>Curabitur</td>
</tr>
<tr>
<td>1,015</td>
<td>sodales</td>
<td>ligula</td>
<td>in</td>
<td>libero</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
I can see the problem now. You just need to remove the offset classes because an offset is done by increasing the margin which in return increases the element's width and renders the total width of both the sidebar and the dashboard bigger than the total width and thus being pushed down.
Change this:
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
To this:
<div class="col-sm-9 col-md-10 main">
Here is a working demo with the fix.