Fixed inconsistencies in table-styling

This commit is contained in:
squidfunk 2017-02-25 11:29:15 +01:00 committed by Martin Donath
parent de3bd8d665
commit 8f48f0bce6
8 changed files with 36 additions and 27 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,3 @@
'
'
{% import "partials/language.html" as lang %} {% import "partials/language.html" as lang %}
<!DOCTYPE html> <!DOCTYPE html>
<html class="no-js"> <html class="no-js">
@ -36,7 +34,7 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script> <script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-4b280ca4d9.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-a7dac97dbb.css">
{% if config.extra.palette %} {% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-02ce7adcc2.palette.css"> <link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-02ce7adcc2.palette.css">
{% endif %} {% endif %}
@ -143,7 +141,7 @@
{% endblock %} {% endblock %}
</div> </div>
{% block scripts %} {% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-f7ac33b6fb.js"></script> <script src="{{ base_url }}/assets/javascripts/application-0dae3d4464.js"></script>
<script>app.initialize({url:{base:"{{ base_url }}"}})</script> <script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %} {% for path in extra_javascript %}
<script src="{{ path }}"></script> <script src="{{ path }}"></script>

View File

@ -48,14 +48,17 @@ export const initialize = config => {
/* Wrap all data tables for better overflow scrolling */ /* Wrap all data tables for better overflow scrolling */
const tables = document.querySelectorAll("table:not([class])") const tables = document.querySelectorAll("table:not([class])")
Array.prototype.forEach.call(tables, table => { Array.prototype.forEach.call(tables, table => {
const wrap = document.createElement("div") const wrap = (
wrap.classList.add("md-typeset__table") <div class="md-typeset__scrollwrap">
<div class="md-typeset__table"></div>
</div>
)
if (table.nextSibling) { if (table.nextSibling) {
table.parentNode.insertBefore(wrap, table.nextSibling) table.parentNode.insertBefore(wrap, table.nextSibling)
} else { } else {
table.parentNode.appendChild(wrap) table.parentNode.appendChild(wrap)
} }
wrap.appendChild(table) wrap.children[0].appendChild(table)
}) })
/* Force 1px scroll offset to trigger overflow scrolling */ /* Force 1px scroll offset to trigger overflow scrolling */

View File

@ -367,18 +367,18 @@ kbd {
table:not([class]) { table:not([class]) {
@include z-depth(2); @include z-depth(2);
margin: 2em 0;
border-radius: 0.2rem;
font-size: ms(-1);
overflow: hidden;
// Semi-cool overflow solution, in case JavaScript is not available
.no-js & {
display: inline-block; display: inline-block;
max-width: 100%; max-width: 100%;
margin: 0.8em 0; border-radius: 0.2rem;
font-size: ms(-1);
overflow: auto; overflow: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
// Due to margin collapse because of the necessary inline-block hack, we
// cannot increase the bottom margin on the table, so we just increase the
// top margin on the following element
& + * {
margin-top: 1.5em;
} }
// Table headings and cells // Table headings and cells
@ -414,16 +414,25 @@ kbd {
} }
} }
// Data table wrapper, in case JavaScript is available // Wrapper for scrolling on overflow
.md-typeset__table { &__scrollwrap {
margin: 1.6em -1.6rem; margin: 1em -1.6rem;
overflow-x: auto; overflow-x: auto;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
}
// Data table wrapper, in case JavaScript is available
.md-typeset__table {
display: inline-block;
margin-bottom: 0.5em;
padding: 0 1.6rem;
// Data tables // Data tables
table { table {
display: inline-block; display: table;
margin: 0 1.6rem; width: 100%;
margin: 0;
overflow: hidden;
} }
} }
} }

View File

@ -1,5 +1,4 @@
' <!--
'<!--
Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com> Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy