Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nate-strauser/530e40ee3bb9b5bb35d366b26e5e1331 to your computer and use it in GitHub Desktop.
Save nate-strauser/530e40ee3bb9b5bb35d366b26e5e1331 to your computer and use it in GitHub Desktop.
How to have a fixed modal header with materializecss
Modal Markup:
<div class="modal modal-fixed-header">
<div class="modal-header">
HEADER CONTENT
</div>
<div class="modal-content">
MAIN CONTENT
</div>
</div>
LESS Styling:
.modal {
background-color: #fff;
&.modal-fixed-header {
padding: 0;
height: 70%;
.modal-header {
border-top: 1px solid rgba(0, 0, 0, 0.1);
position: absolute;
top: 0;
}
.modal-header {
border-radius: 0 0 2px 2px;
//background-color: #fafafa;
padding: 4px 6px;
height: 56px;
width: 100%;
}
.modal-content {
position: absolute;
top:56px;
height: calc(100% - 56px);
max-height: 100%;
width: 100%;
overflow-y: auto;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment