fix(css): fix some css bugs

This commit is contained in:
Dillon
2020-01-31 18:46:28 +08:00
parent 7e6236361f
commit 344f0a9f41
36 changed files with 705 additions and 429 deletions

View File

@@ -1,7 +1,5 @@
@import url(https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900);
html {
font-family: "Lato", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", STHeiti, "Microsoft Yahei", "WenQuanYi Micro Hei", Arial, Verdana, sans-serif;
font-family: $global-font-family;
/* scrollbar, only support webkit */
&::-webkit-scrollbar {

View File

@@ -1,5 +1,5 @@
@media only screen and (max-width: 1800px) {
.post-warp {
.warpper {
max-width: 780px;
.post-toc {
@@ -9,7 +9,7 @@
}
@media only screen and (max-width: 1300px) {
.post-warp {
.warpper {
max-width: 560px;
.post-toc {
@@ -25,7 +25,7 @@
}
}
.post-warp {
.warpper {
max-width: 80%;
.post-toc {
@@ -38,7 +38,7 @@
}
}
@media only screen and (max-width: 480px) {
@media only screen and (max-width: 560px) {
.navbar {
display: none;
}
@@ -47,7 +47,7 @@
display: block;
}
.post-warp {
.warpper {
max-width: 100%;
.categories-card {

View File

@@ -1,4 +1,4 @@
/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
@@ -7,41 +7,35 @@
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
@charset "UTF-8";
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
html {
line-height: 1.15; /* 1 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/* Sections
========================================================================== */
========================================================================== */
/**
* Remove the margin in all browsers.
*/
* Remove the margin in all browsers.
*/
html,
body,
main,
div,
span,
a,
li,
ul,
hr,
h1,
h2,
h3,
h4,
h5,
h6 {
padding: 0;
body {
margin: 0;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
@@ -49,12 +43,12 @@ h1 {
}
/* Grouping content
========================================================================== */
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box; /* 1 */
@@ -63,9 +57,9 @@ hr {
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace; /* 1 */
@@ -73,20 +67,20 @@ pre {
}
/* Text-level semantics
========================================================================== */
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none; /* 1 */
@@ -95,8 +89,8 @@ abbr[title] {
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
@@ -104,9 +98,9 @@ strong {
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
@@ -116,17 +110,17 @@ samp {
}
/**
* Add the correct font size in all browsers.
*/
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
@@ -145,23 +139,23 @@ sup {
}
/* Embedded content
========================================================================== */
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
@@ -175,30 +169,28 @@ textarea {
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input {
/* 1 */
input { /* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select {
/* 1 */
select { /* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
@@ -208,8 +200,8 @@ button,
}
/**
* Remove the inner border and padding in Firefox.
*/
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
@@ -220,8 +212,8 @@ button::-moz-focus-inner,
}
/**
* Restore the focus styles unset by the previous rule.
*/
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
@@ -231,19 +223,19 @@ button:-moz-focusring,
}
/**
* Correct the padding in Firefox.
*/
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box; /* 1 */
@@ -255,25 +247,25 @@ legend {
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
@@ -282,8 +274,8 @@ textarea {
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
@@ -291,9 +283,9 @@ textarea {
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield; /* 1 */
@@ -301,17 +293,17 @@ textarea {
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button; /* 1 */
@@ -319,38 +311,38 @@ textarea {
}
/* Interactive
========================================================================== */
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
* Add the correct display in IE 10.
*/
[hidden] {
display: none;

View File

@@ -1,6 +1,6 @@
@import "_home";
.post-warp {
.warpper {
position: relative;
width: 100%;
max-width: 960px;
@@ -26,4 +26,4 @@
text-align: right;
padding-bottom: 2rem;
}
}
}

View File

@@ -7,14 +7,14 @@
.post-meta {
font-size: .88rem;
color: rgba(85, 85, 85, 0.52941) !important;
color: $global-font-secondary-color;
span {
display: inline-block;
}
.dark-theme & {
color: $global-font-secondary-color-dark !important;
color: $global-font-secondary-color-dark;
}
a {
@@ -246,7 +246,6 @@
max-width: 100%;
margin: .625rem 0;
border-spacing: 0;
box-shadow: 2px 2px 3px rgba(0,0,0,.125);
background: $table-background-color;
.dark-theme & {
@@ -306,7 +305,7 @@
margin: 0 0 2em 0;
position: relative;
&:before {
&::before {
content: '\201C';
position: absolute;
top: 0em;
@@ -323,8 +322,8 @@
}
}
&:after {
content: "#blockquote" attr(cite);
&::after {
content: '#blockquote' attr(cite);
display: block;
text-align: right;
font-size: 0.875em;
@@ -340,6 +339,14 @@
}
}
.footnotes {
color: $global-font-secondary-color;
.dark-theme & {
color: $global-font-secondary-color-dark;
}
}
@import "../_partial/_post/code";
@import "../_partial/_post/admonition";
@@ -420,45 +427,9 @@
.code {
padding: .375rem;
font-size: .875rem;
font-family: Consolas, Monaco, Menlo, Consolas, monospace;
font-family: $code-font-family;
font-weight: bold;
word-break: break-all;
.k {
color: #D371E3;
}
.kt {
color: #D371E3;
}
.kc {
color: #D371E3;
}
.o {
color: #D371E3;
}
.nf {
color: #F16473;
}
.na {
color: #41B1F5;
}
.s {
color: #8BC56F;
}
.n {
color: #DB975C;
}
.c1 {
color: #7E848F;
}
}
}
@@ -544,20 +515,20 @@
}
.post-nav {
&:before,
&:after {
content: " ";
&::before,
&::after {
content: ' ';
display: table;
}
& a.prev,
& a.next {
font-weight: 600;
font-size: 1rem;
font-weight: 600;
transition-duration: .3s;
transition-property: transform;
transition-timing-function: ease-out;
transition-duration: 0.3s;
}
& a.prev {
@@ -580,4 +551,4 @@
.post-comment {
padding: 4rem 0;
}
}

View File

@@ -24,7 +24,7 @@
width: 100%;
padding: 30% 0 0;
position: relative;
margin-bottom: 1rem;
margin: 0.6rem auto;
img {
position: absolute;
@@ -32,7 +32,7 @@
height: 100%;
left: 0;
top: 0;
object-fit: scale-down;
object-fit: cover;
}
}

View File

@@ -34,9 +34,8 @@ p > code {
// chroma
.highlight > .chroma {
margin: 1em 0;
border-radius: 5px;
border-radius: 6px;
overflow-x: auto;
box-shadow: 1px 1px 2px rgba(0,0,0,0.125);
position: relative;
background: $code-background-color;
@@ -66,7 +65,7 @@ p > code {
}
@each $sign, $text in $code-type-list {
&.#{$sign} table::after {
& .#{$sign} table::after {
content: $text;
}
}
@@ -119,7 +118,7 @@ p > code {
}
}
.code {
.highlight {
/* Parentheses */ .p { color: #A9A9B3 }
/* Keyword */ .k { color: #859900 }
/* KeywordConstant */ .kc { color: #859900; font-weight: bold }

View File

@@ -3,6 +3,10 @@
// ==============================
// ========== Global ========== //
@import url(https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900);
$global-font-family: Lato, -apple-system, BlinkMacSystemFont, PingFang-SC-Regular, Hiragino Sans GB, Microsoft Yahei, Arial, sans-serif !default;
// Background color of the body
$global-background-color: #fff !default;
$global-background-color-dark: #292a2d !default;
@@ -31,7 +35,7 @@ $navbar-active-color-dark: #fff !default;
$post-link-color: #2d96bd !default;
$post-link-color-dark: #eee !default;
$post-link-hover-color: #ef3982 !default;
$post-link-hover-color-dark: #fff !default;
$post-link-hover-color-dark: #2d96bd !default;
$pagination-link-color: #2d96bd !default;
$pagination-link-color-dark: #a9a9b3 !default;
@@ -52,7 +56,7 @@ $code-color: #E74C3C !default;
$code-color-dark: #E5BF78 !default;
// Color of the code background.
$code-background-color: whitesmoke !default;
$code-background-color: #f5f5f5 !default;
$code-background-color-dark: #272C34 !default;
$code-info-color: #cacaca !default;
@@ -61,7 +65,7 @@ $code-info-color: #cacaca !default;
$code-font-size: 13px !default;
// Font family of the code.
$code-font-family: Consolas, Monaco, Menlo, "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace !default;
$code-font-family: Source Code Pro, Consolas, Liberation Mono, Menlo, Courier, monospace !default;
// Code type list.
$code-type-list: (

View File

@@ -157,27 +157,23 @@ jQuery(function($) {
};
changeTocState();
const HEADERFIX = 100;
const HEADERFIX = 150;
const $toclink = $('.toc-link');
const $headerlink = $('.headerlink');
const $tocLinkLis = $('.post-toc-content li');
const activeIndex = function() {
const activeIndex = function () {
const scrollTop = $(window).scrollTop();
const headerlinkTop = $.map($headerlink, function(link) {
return $(link).offset().top;
});
const headerLinksOffsetForSearch = $.map(headerlinkTop, function(offset) {
return offset - HEADERFIX;
});
const searchActiveTocIndex = function(array, target) {
for (let i = 0; i < array.length - 1; i++) {
if (target > array[i] && target <= array[i + 1]) return i;
if ( target < array[i + 1]) return i;
}
if (target > array[array.length - 1]) return array.length - 1;
return 0;
return array.length - 1;
};
const activeTocIndex = searchActiveTocIndex(headerLinksOffsetForSearch, scrollTop);
const activeTocIndex = searchActiveTocIndex(headerlinkTop, scrollTop + HEADERFIX);
$($toclink).removeClass('active');
$($tocLinkLis).removeClass('has-active');

32
assets/svg/loading.svg Normal file
View File

@@ -0,0 +1,32 @@
<!-- By Sam Herbert (@sherb), for everyone. More @ http://goo.gl/7AJzbL -->
<svg width="319" height="319" viewBox="-281 -281 600 600" xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient x1="8.042%" y1="0%" x2="65.682%" y2="23.865%" id="a">
<stop stop-color="#a5a5a5" stop-opacity="0" offset="0%"/>
<stop stop-color="#a5a5a5" stop-opacity=".631" offset="63.146%"/>
<stop stop-color="#a5a5a5" offset="100%"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<g transform="translate(1 1)">
<path d="M36 18c0-9.94-8.06-18-18-18" id="Oval-2" stroke="url(#a)" stroke-width="2">
<animateTransform
attributeName="transform"
type="rotate"
from="0 18 18"
to="360 18 18"
dur="0.9s"
repeatCount="indefinite" />
</path>
<circle fill="#a5a5a5" cx="36" cy="18" r="1">
<animateTransform
attributeName="transform"
type="rotate"
from="0 18 18"
to="360 18 18"
dur="0.9s"
repeatCount="indefinite" />
</circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB