Modals
JS Optional
Modals are flexible dialog prompts.
This is the content inside the modal.
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent risus leo, dictum in vehicula sit amet, feugiat tempus tellus. Duis quis sodales risus. Etiam euismod ornare consequat.
Climb leg rub face on everything give attitude nap all day for under the bed. Chase mice attack feet but rub face on everything hopped up on goofballs.
Cupcake ipsum
Jelly-o sesame snaps halvah croissant oat cake cookie. Cheesecake bear claw topping. Chupa chups apple pie carrot cake chocolate cake caramels.
De braaaiiiins apocalypsi gorger omero prefrontal cortex undead survivor fornix dictum mauris. Hi brains mindless mortuis limbic cortex soulless creaturas optic nerve.
Candy ipsum
Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar.
Caerphilly swiss fromage frais. Brie cheese and wine fromage frais chalk and cheese danish fontina smelly cheese who moved my cheese cow.
Add a container element with the modal
class. And add a real container modal-container
and overlay modal-overlay
inside it. You can add child elements with the modal-header
, modal-body
and modal-footer
- any or all of them.
<!-- button trigger -->
<a class="btn btn-primary" href="#modal-1">Open Modal</a>
<!-- modal container -->
<div class="modal" id="modal-1">
<a href="#close" class="modal-overlay" aria-label="Close"></a>
<div class="modal-container">
<div class="modal-header">
<a href="#close" class="btn btn-clear float-right" aria-label="Close"></a>
<div class="modal-title h5">Modal title</div>
</div>
<div class="modal-body">
<div class="content">
<!-- content here -->
</div>
</div>
<div class="modal-footer">
...
</div>
</div>
</div>
The CSS-only version works by leveraging the CSS pseudo-property :target
which works in conjunction with the location hash; clicking on a link with href
#modal-1
changes the URL and displays the HTML element with the id
modal-1
. To close, you can change the location hash to something like #close
or just #
.
In JavaScript, you can toggle modal
container visibility by adding the active
class.
Sizes
Use the modal-sm
class for a smaller modal dialog. The container max width is 320px
.
This is the content inside the modal.
Lorem ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent risus leo, dictum in vehicula sit amet, feugiat tempus tellus. Duis quis sodales risus. Etiam euismod ornare consequat.
Climb leg rub face on everything give attitude nap all day for under the bed. Chase mice attack feet but rub face on everything hopped up on goofballs.
Cupcake ipsum
Jelly-o sesame snaps halvah croissant oat cake cookie. Cheesecake bear claw topping. Chupa chups apple pie carrot cake chocolate cake caramels.
De braaaiiiins apocalypsi gorger omero prefrontal cortex undead survivor fornix dictum mauris. Hi brains mindless mortuis limbic cortex soulless creaturas optic nerve.
Candy ipsum
Efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar.
Caerphilly swiss fromage frais. Brie cheese and wine fromage frais chalk and cheese danish fontina smelly cheese who moved my cheese cow.
Use the modal-lg
class for a full size modal. The container max width is 960px
.
<div class="modal modal-sm">
<a href="#close" class="modal-overlay" aria-label="Close"></a>
<div class="modal-container">
<!-- modal structure here -->
</div>
</div>