1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-12-24 13:24:55 +01:00
mkdocs-material/src/assets/stylesheets/layout/_base.scss
2016-10-24 18:02:53 +02:00

176 lines
4.3 KiB
SCSS

////
/// Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS
////
// ----------------------------------------------------------------------------
// Rules: base grid and containers
// ----------------------------------------------------------------------------
// Stretch container to viewport and set base font-size to 10px for simple
// calculations base on relative ems (rems).
html {
height: 100%;
font-size: 62.5%;
// [screen medium +]: Set base font-size to 11px
@include break-from-device(screen medium) {
font-size: 68.75%;
}
// [screen large +]: Set base font-size to 12px
@include break-from-device(screen large) {
font-size: 75%;
}
}
// Stretch body to container and leave room for footer.
body {
position: relative;
min-height: 100%;
// [tablet portrait -]: Lock body to disable scroll bubbling
@include break-to-device(tablet portrait) {
// Lock body to viewport height (e.g. in search mode)
&[data-md-locked] {
height: 100%;
overflow: hidden;
}
}
}
// Horizontal separators
hr {
display: block;
height: 0.1rem;
padding: 0;
border: 0;
}
// Template-wide grid
.md-grid {
max-width: 120.0rem;
margin-right: auto;
margin-left: auto;
}
// Prevent collapse of margin when setting margin on child element
.md-container,
.md-main {
overflow: auto;
}
// Add top spacing to acount for header
.md-main {
margin-top: 5.6rem;
// Bottom spacing to account for header and footer
&__inner {
margin-top: 2.4rem + 0.6rem;
margin-bottom: 9.2rem;
overflow: auto;
}
}
// ----------------------------------------------------------------------------
// Rules: navigational elements
// ----------------------------------------------------------------------------
// Toggle checkbox
.md-toggle {
display: none;
}
// Overlay below expanded drawer
.md-overlay {
position: fixed;
top: 0;
width: 0;
height: 0;
transition:
width 0s 0.25s,
height 0s 0.25s,
opacity 0.25s;
background: $md-color-black--light;
opacity: 0;
z-index: 2;
// [tablet -]: Trigger overlay
@include break-to-device(tablet) {
// Expanded drawer
.md-toggle--drawer:checked ~ & {
width: 100%;
height: 100%;
transition:
width 0s,
height 0s,
opacity 0.25s;
opacity: 1;
}
}
}
// ----------------------------------------------------------------------------
// Rules: flexible elements, implemented with table layout
// ----------------------------------------------------------------------------
// Flexible layout container
.md-flex {
display: table;
// Flexible layout container cell/element
&__cell {
display: table-cell;
position: relative;
vertical-align: top;
// Shrink to minimum width
&--shrink {
width: 0%;
}
// Stretch to maximum width
&--stretch {
display: table;
width: 100%;
table-layout: fixed;
}
}
// Apply ellipsis in case of overflowing text
&__ellipsis {
display: table-cell;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
}
// ----------------------------------------------------------------------------
// Rules: print styles
// ----------------------------------------------------------------------------
// Add margins to page
@page {
margin: 25mm;
}