From 7384d0377caf3ca0292adcf6a97d12e3ad71b577 Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Mon, 28 Nov 2022 01:30:18 +0800 Subject: [PATCH] Optimize CSS selectors --- source/css/_common/scaffolding/tags/note.styl | 10 +++++++++- source/css/_mixins.styl | 18 +++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/source/css/_common/scaffolding/tags/note.styl b/source/css/_common/scaffolding/tags/note.styl index c732394..fcbdfae 100644 --- a/source/css/_common/scaffolding/tags/note.styl +++ b/source/css/_common/scaffolding/tags/note.styl @@ -5,7 +5,7 @@ if (hexo-config('note.style') != 'disabled') { border-radius: $note-border-radius; margin-bottom: 20px; - padding: 1em 1em 0; + padding: 1em; position: relative; if ($note-style == 'simple') { @@ -39,6 +39,14 @@ if (hexo-config('note.style') != 'disabled') { padding-top: 0; } + :first-child { + margin-top: 0; + } + + :last-child { + margin-bottom: 0; + } + if ($note-icons) { &:not(.no-icon) { padding-left: 2.5em; diff --git a/source/css/_mixins.styl b/source/css/_mixins.styl index d517697..d47cca2 100644 --- a/source/css/_mixins.styl +++ b/source/css/_mixins.styl @@ -166,26 +166,26 @@ round-icon($diameter) { toggle-arrow($position) { if ($position == 'right') { - .toggle-line:first-child { + :first-child { top: 2px; transform: rotate(-45deg); width: 50%; } - .toggle-line:last-child { + :last-child { top: -2px; transform: rotate(45deg); width: 50%; } } else { - .toggle-line:first-child { + :first-child { left: 50%; top: 2px; transform: rotate(45deg); width: 50%; } - .toggle-line:last-child { + :last-child { left: 50%; top: -2px; transform: rotate(-45deg); @@ -195,27 +195,27 @@ toggle-arrow($position) { } toggle-close($position) { - .toggle-line:nth-child(2) { + :nth-child(2) { opacity: 0; } if ($position == 'right') { - .toggle-line:first-child { + :first-child { top: 6px; transform: rotate(-45deg); } - .toggle-line:last-child { + :last-child { top: -6px; transform: rotate(45deg); } } else { - .toggle-line:first-child { + :first-child { top: 6px; transform: rotate(45deg); } - .toggle-line:last-child { + :last-child { top: -6px; transform: rotate(-45deg); }