Stacked List of Cards
Style unordered list items with CSS to give each list item its own card that moves on hover.
by Jon Fuller
HTML
<script src="https://use.fontawesome.com/e765ac845f.js"></script>
<div>
<h1>Stacked List of Cards</h1>
<p>Just wrap your unordered list items in a class of .checklist and .stackedlist to give each list item its own card that moves on hover.</p>
</div>
<div class="checklist stackedlist">
<ul>
<li>We can arm advisors with a <strong>competitive edge</strong> by providing their clients with valuable HR, payroll, technology, workers’ comp, and employee benefits services</li>
<li>TestCo pays a <strong>generous commission</strong> structure on a residual basis for the life of the account</li>
<li>Our partnership agreements contain a <strong>“no trespassing” clause</strong>, which prohibits us from soliciting your client a competing product, or trying to turn them upon renewal</li>
<li>We keep you as a <strong>primary focus</strong> in the partnership and can include you in ongoing communications and updates</li>
<li>TestCo is <strong>accredited and certified</strong> by ESAC (Employee Services Assurance Corporation) which guarantees our performance</li>
</ul>
</div>
<div>
<p>Pretty cool, right?</p>
</div>
CSS
body {
font-family: sans-serif;
font-size: 16px;
line-height: 1.6em;
padding: 20px 40px;
}
* {
box-sizing: border-box;
}
/* -- CHECKLIST -- */
.checklist ul {
margin: 0;
padding: 0 !important;
list-style: none;
}
.checklist ul li {
position: relative;
padding-left: 30px;
margin: 0 0 6px !important;
}
.checklist ul li::before {
font-family: 'FontAwesome';
content: '\f058';
width: 20px;
margin: 0;
display: inline-block;
text-align: center;
position: absolute;
top: 0;
left: 0;
color: #32a709;
/* set font size helps make icon sharper */
font-size: 22px;
font-weight: normal;
}
/* -- END CHECKLIST -- */
/* PARTNER HIGHLIGHTS SECTION -- */
.stackedlist.checklist ul li {
padding: 20px 10px 25px 45px;
background-color: rgb(247, 251, 245);
border-radius: 3px;
box-shadow: 0 0 10px rgba(0,0,0,0.15);
border: 1px solid white;
margin-bottom: 0 !important;
margin-top: -5px !important;
transition: all 0.2s ease;
}
.stackedlist.checklist ul li:last-child {
/* margin-bottom: 0 !important; */
}
.stackedlist.checklist ul li:hover {
background-color: white;
box-shadow: 0 2px 12px rgba(0,0,0,0.2);
border: 1px solid rgba(94, 167, 69, 1);
margin-top: -10px !important;
padding-bottom: 30px !important;
}
.stackedlist.checklist ul li::before {
width: 26px;
font-size: 26px;
left: 10px;
top: 20px;
}