Skip to content

Instantly share code, notes, and snippets.

@qzchenwl
Created February 7, 2025 08:18
Show Gist options
  • Save qzchenwl/2f46a32668ce4a8b4f62b74ba3b2be3c to your computer and use it in GitHub Desktop.
Save qzchenwl/2f46a32668ce4a8b4f62b74ba3b2be3c to your computer and use it in GitHub Desktop.
markdown.css
@import url(http://fonts.googleapis.com/css?family=Merriweather:300italic,300);
body {
font-family: 'Merriweather', Georgia, serif;
line-height: 1.6;
color: #333;
max-width: 860px;
margin: 0 auto;
padding: 2rem;
background-color: #f9f9f9;
}
/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
color: #2c3e50;
margin: 1.5em 0 1em;
border-bottom: 1px solid #eee;
padding-bottom: 0.3em;
}
h1 { font-size: 2.2em; }
h2 { font-size: 1.8em; }
h3 { font-size: 1.5em; }
/* 段落和文本 */
p {
margin: 1em 0;
text-wrap: pretty;
word-wrap: break-word; /* 允许单词换行 */
hyphens: auto; /* 自动根据单词边界插入连字符 */
word-spacing: 0.1em; /* 调整单词间距,避免大空隙 */
letter-spacing: 0.05em; /* 适当设置字间距 */
white-space: normal; /* 允许换行 */
}
strong { color: #2c3e50; }
em { color: #666; }
/* 列表 */
ul, ol {
padding-left: 1.8em;
margin: 1em 0;
}
li {
margin: 0.5em 0;
}
/* 代码块 */
pre {
background-color: #f5f7f9;
border-radius: 6px;
padding: 1.2em;
overflow-x: auto;
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
code {
font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
background-color: #f5f7f9;
padding: 0.2em 0.4em;
border-radius: 3px;
font-size: 0.95em;
}
/* 引用块 */
blockquote {
border-left: 4px solid #dfe2e5;
color: #666;
margin: 1em 0;
padding: 0.5em 1em;
background-color: #f8f9fa;
}
/* 表格 */
table {
border-collapse: collapse;
width: 100%;
margin: 1.5em 0;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
border: 1px solid #dfe2e5;
padding: 0.8em;
text-align: left;
}
th {
background-color: #f8f9fa;
font-weight: 600;
}
tr:nth-child(even) {
background-color: #f8f9fa;
}
/* 链接 */
a {
color: #3498db;
text-decoration: none;
transition: color 0.2s;
}
a:hover {
color: #2980b9;
text-decoration: underline;
}
/* 图片 */
img {
max-width: 100%;
height: auto;
display: block;
margin: 1.5em auto;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* 水平分割线 */
hr {
border: 0;
height: 1px;
background: #e1e4e8;
margin: 2em 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment