标签:div 添加 http mon int border flex logs flow
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: "Monda", "PingFang SC", "Microsoft YaHei", sans-serif;
font-size: 14px;
line-height: 1.5;
color: #555;
background: #f0f2f5;
}
body,
ul,
#profile_block {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
a {
font-size: inherit;
line-height: inherit;
text-decoration: none;
color: inherit;
}
a[href="#top"],
input[type="button"],
.feedbackListSubtitle .louzhu {
margin: 0 4px;
border-radius: 2px;
background: #409eff;
color: #fff;
border: 0;
font-size: 12px;
cursor: pointer;
}
#blogTitle,
.topicListFooter {
display: none;
}
#home {
position: relative;
margin: 0 auto 0;
padding: 60px 0 30px;
max-width: 1230px;
}
#header {
position: fixed;
z-index: 999;
top: 0;
left: 0;
width: 100%;
height: 44px;
background-color: #222;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
}
#navigator {
margin: 0 auto;
height: 44px;
max-width: 1230px;
}
#navList > li {
float: left;
}
#navList > li a {
display: block;
margin-right: 33px;
line-height: 44px;
color: #9d9d9d;
}
#navList > li a:hover {
color: #fff;
}
#main {
position: relative;
}
#main a:hover {
color: #409eff;
}
#mainContent {
position: relative;
margin-left: 280px;
padding: 0 24px 1px;
background: #fff;
border-radius: 2px;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.day,
.entrylist {
min-height: 32px;
}
.day {
border-bottom: 1px solid #eaecef;
margin-bottom: 12px;
}
.entrylist > p {
display: none;
}
.entrylistTitle {
position: absolute;
margin: 6px;
right: 6px;
font-size: 14px;
font-style: italic;
font-weight: bold;
}
.dayTitle a {
display: none;
}
div.postTitle a,
.entrylistPosttitle a {
display: inline-block;
padding: 10px 0 6px;
font-size: 16px;
color: #555;
font-weight: 600;
line-height: 36px;
}
.c_b_p_desc {
color: #666;
}
.day .postDesc,
.entrylistItemPostDesc {
text-align: right;
line-height: 36px;
font-size: 12px;
}
.postSeparator {
border-bottom: 1px dashed #dae1ea;
}
.post > h1 {
margin: 0;
line-height: 2;
}
.post > h1 a {
font-weight: 400;
font-size: 24px;
color: #000 !important;
text-shadow: 0 0 2px #999;
}
#infos {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
margin-bottom: 20px;
padding-bottom: 10px;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border-bottom: 1px solid #eaecef;
}
#BlogPostCategory {
margin: 0 20px 0 0;
}
div.cnblogs-markdown {
line-height: 2;
color: #314659;
}
div.cnblogs-markdown pre {
position: relative;
background: #f7f7f7;
}
#cnblogs_post_body a {
color: #409eff;
}
pre > span {
position: absolute;
top: 0;
right: 0;
border-radius: 2px;
padding: 0 10px;
font-size: 12px;
background: rgba(0, 0, 0, 0.4);
color: #fff;
cursor: pointer;
}
pre > .copyed {
background: #67c23a;
}
.blogpost-body.cnblogs-markdown code {
border: none !important;
padding: 4px !important;
line-height: inherit !important;
background: #f7f7f7 !important;
color: #314659;
font: 12px source-code-pro, Menlo, Monaco, Consolas, Courier New, monospace !important;
}
div.cnblogs-markdown code.hljs {
line-height: 2 !important;
padding: 10px 12px !important;
max-height: 560px;
overflow: auto;
}
#green_channel {
position: fixed;
top: 40%;
right: 20px;
margin: 0;
border: 0;
padding: 0;
width: 88px;
}
#green_channel img {
display: none !important;
}
#green_channel a {
background-image: none;
margin: 0 0 10px 0 !important;
border-radius: 2px;
width: 72px;
font-size: 12px;
}
#green_channel #green_channel_digg {
background-color: #67c23a;
}
a[href="#top"] {
position: fixed;
padding: 4px 10px;
bottom: 20%;
right: 20px;
}
.feedbackItem {
margin-bottom: 10px;
border-bottom: 1px solid #eaecef;
padding-bottom: 10px;
}
.feedbackListSubtitle {
color: #fff;
}
.feedbackListSubtitle :not(p) {
line-height: 2;
color: #555;
}
.feedbackListSubtitle .louzhu {
padding: 1px 6px;
}
.blog_comment_body {
margin: 6px 0 10px;
padding: 6px 14px;
background: #f6f8fa;
}
#sideBar {
position: fixed;
top: 60px;
border-radius: 2px;
max-height: 720px;
z-index: 888;
width: 265px;
background: #fff;
-webkit-box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
#sideBar h3 {
margin: 0;
font-size: 1em;
padding: 6px 22px;
background: #fff;
}
#sideBar h3 + * {
margin-bottom: 10px;
border-radius: 2px;
padding: 0 22px;
background: #fff;
}
#widget_my_zzk #q {
border: 0;
border-bottom: 1px solid #ddd;
width: 162px;
}
.div_my_zzk {
margin-top: 0;
margin-bottom: 0;
}
#sidebar_postcategory ul {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
#TopViewPostsBlock li {
margin-bottom: 4px;
}
#sideBar ul li a {
margin: 6px 1px;
font-size: 12px;
}
#sidebar_postcategory ul li a {
display: block;
color: #fa8c16 !important;
font-size: 12px;
padding: 0 12px;
border: 1px solid #ffd591;
border-radius: 4px;
line-height: 20px;
background: #fff7e6;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
}
@media only screen and (max-width: 767px) {
.swit {
display: block;
}
#home {
max-width: 100%;
}
#navigator {
max-width: 100%;
padding: 0 12px;
}
#main {
padding: 0 !important;
}
#mainContent {
margin-left: 0 !important;
padding-left: 20px;
padding-right: 20px;
}
#sideBar {
display: none;
-webkit-box-shadow: 3px 3px 3px 1px #999;
box-shadow: 3px 3px 3px 1px #999;
}
div#comment_form {
margin-left: 0;
}
a[href="#top"],
#green_channel {
position: static;
}
}
<script src="https://cdn.bootcss.com/clipboard.js/2.0.4/clipboard.min.js"></script>
$(function () {
if ($('#post-date')[0]) {
var d = $('<div id="infos"></div>');
d.append($('.postDesc')).append(
$('#BlogPostCategory')
);
$('h1.postTitle').after(d);
var pres = $('pre');
if (pres.length) {
pres.each(function () {
var t = $(this).children('code').text();
var btn = $('<span class="copy">复制</span>').attr('data-clipboard-text', t)
$(this).prepend(btn);
var c = new ClipboardJS(btn[0]);
c.on('success', function () {
btn.addClass('copyed').text('复制成功')
})
c.on('error', function () {
btn.text('复制失败')
})
btn.mouseleave(function () {
btn.text('复制').removeClass('copyed')
})
})
}
window.onscroll = function () {
if ($('a[href="#top"]').css('position') === 'static') return;
var y = window.scrollY;
if (y >= 500) {
$('a[href="#top"]').show()
} else {
$('a[href="#top"]').hide()
}
}
}
})
先添加复制按钮 css
pre {
position: relative;
}
pre > span {
position: absolute;
top: 0;
right: 0;
border-radius: 2px;
padding: 0 10px;
font-size: 12px;
background: rgba(0, 0, 0, 0.4);
color: #fff;
cursor: pointer;
}
pre > .copyed {
background: #67c23a;
}
引入复制所需的库clipboard.js
<script src="https://cdn.bootcss.com/clipboard.js/2.0.4/clipboard.min.js"></script>
使用复制功能,需开通 js 功能
$(function() {
if ($("#post-date")[0]) {
var pres = $("pre");
if (pres.length) {
pres.each(function() {
var t = $(this)
.children("code")
.text();
var btn = $('<span class="copy">复制</span>').attr(
"data-clipboard-text",
t
);
$(this).prepend(btn);
var c = new ClipboardJS(btn[0]);
c.on("success", function() {
btn.addClass("copyed").text("复制成功");
});
c.on("error", function() {
btn.text("复制失败");
});
btn.mouseleave(function() {
btn.text("复制").removeClass("copyed");
});
});
}
}
});
标签:div 添加 http mon int border flex logs flow
原文地址:https://www.cnblogs.com/ak-b/p/11022799.html