forked from s2339956/s2339956.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
markdown-table-style.html
655 lines (449 loc) · 35.8 KB
/
markdown-table-style.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
<!DOCTYPE html>
<html lang="zh-Hant-TW">
<head>
<!--[if lt IE 9]>
<style>body {display: none; background: none !important} </style>
<meta http-equiv="Refresh" Content="0; url=//outdatedbrowser.com/" />
<![endif]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no" />
<meta name="author" content="Tin" />
<meta name="description" content="Markdown 寫的表格最終會被解析成 HTML 格式,如果使用的編輯器支持自定義 CSS,就能方便的調整樣式。如果可以引入 JavaScript,樣式自適應也能較好地實現。">
<meta name="keywords" content="Markdown,Table,CSS,JavaScript">
<meta property="og:type" content="article">
<meta property="og:title" content="Markdown 表格樣式調整與自適應優化">
<meta property="og:url" content="http://s2339956.github.io/markdown-table-style.html">
<meta property="og:site_name" content="Tin Blog">
<meta property="og:description" content="Markdown 寫的表格最終會被解析成 HTML 格式,如果使用的編輯器支持自定義 CSS,就能方便的調整樣式。如果可以引入 JavaScript,樣式自適應也能較好地實現。">
<meta property="og:locale" content="zh-Hant-TW">
<meta property="og:updated_time" content="2017-11-15T10:09:40.055Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Markdown 表格樣式調整與自適應優化">
<meta name="twitter:description" content="Markdown 寫的表格最終會被解析成 HTML 格式,如果使用的編輯器支持自定義 CSS,就能方便的調整樣式。如果可以引入 JavaScript,樣式自適應也能較好地實現。">
<link rel="apple-touch-icon" href= "/apple-touch-icon.png">
<link rel="alternate" href="/atom.xml" title="Tin Blog" type="application/atom+xml">
<link rel="shortcut icon" href="/favicon.png">
<link href="//cdn.bootcss.com/animate.css/3.5.1/animate.min.css" rel="stylesheet">
<link href="//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.css" rel="stylesheet">
<script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
<link href="//cdn.bootcss.com/pace/1.0.2/themes/blue/pace-theme-minimal.css" rel="stylesheet">
<link rel="stylesheet" href="/css/style.css">
<link href="//cdn.bootcss.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
<title>Markdown 表格樣式調整與自適應優化 | Tin Blog</title>
<script src="//cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
<script>
var yiliaConfig = {
fancybox: true,
animate: true,
isHome: false,
isPost: true,
isArchive: false,
isTag: false,
isCategory: false,
fancybox_js: "//cdn.bootcss.com/fancybox/2.1.5/jquery.fancybox.min.js",
scrollreveal: "//cdn.bootcss.com/scrollReveal.js/3.1.4/scrollreveal.min.js",
search: true
}
</script>
<script>
yiliaConfig.jquery_ui = [true, "//cdn.bootcss.com/jqueryui/1.10.4/jquery-ui.min.js", "//cdn.bootcss.com/jqueryui/1.10.4/css/jquery-ui.min.css"];
</script>
<script> yiliaConfig.rootUrl = "\/";</script>
</head>
<body>
<div id="container">
<div class="left-col">
<div class="overlay"></div>
<div class="intrude-less">
<header id="header" class="inner">
<a href="/" class="profilepic">
<img src="/img/avatar.png" class="animated zoomIn">
</a>
<hgroup>
<h1 class="header-author"><a href="/">Tin</a></h1>
</hgroup>
<p class="header-subtitle">星星給予仰望者光芒</p>
<form id="search-form">
<input type="text" id="local-search-input" name="q" placeholder="search..." class="search form-control" autocomplete="off" autocorrect="off" searchonload="false" />
<i class="fa fa-times" onclick="resetSearch()"></i>
</form>
<div id="local-search-result"></div>
<p class='no-result'>No results found <i class='fa fa-spinner fa-pulse'></i></p>
<div id="switch-btn" class="switch-btn">
<div class="icon">
<div class="icon-ctn">
<div class="icon-wrap icon-house" data-idx="0">
<div class="birdhouse"></div>
<div class="birdhouse_holes"></div>
</div>
<div class="icon-wrap icon-ribbon hide" data-idx="1">
<div class="ribbon"></div>
</div>
<div class="icon-wrap icon-link hide" data-idx="2">
<div class="loopback_l"></div>
<div class="loopback_r"></div>
</div>
<div class="icon-wrap icon-me hide" data-idx="3">
<div class="user"></div>
<div class="shoulder"></div>
</div>
</div>
</div>
<div class="tips-box hide">
<div class="tips-arrow"></div>
<ul class="tips-inner">
<li>選單</li>
<li>標籤</li>
<li>友情連結</li>
<li>關於我</li>
</ul>
</div>
</div>
<div id="switch-area" class="switch-area">
<div class="switch-wrap">
<section class="switch-part switch-part1">
<nav class="header-menu">
<ul>
<li><a href="/">主頁</a></li>
<li><a href="/archives/">所有文章</a></li>
<li><a href="/tags/">標籤</a></li>
<li><a href="/about/">關於我</a></li>
</ul>
</nav>
<nav class="header-nav">
<ul class="social">
<a class="fa Email" href="mailto:[email protected]" title="Email"></a>
<a class="fa GitHub" href="https://github.com/s2339956" title="GitHub"></a>
<a class="fa RSS" href="/atom.xml" title="RSS"></a>
<a class="fa 微信" href="/s2339956" title="微信"></a>
<a class="fa Instagram" href="https://www.instagram.com/s2339956/" title="Instagram"></a>
</ul>
</nav>
</section>
<section class="switch-part switch-part2">
<div class="widget tagcloud" id="js-tagcloud">
<ul class="tag-list"><li class="tag-list-item"><a class="tag-list-link" href="/tags/CSS/">CSS</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Hexo/">Hexo</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Markdown/">Markdown</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Objective-C/">Objective-C</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Python/">Python</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Table/">Table</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/Xcode/">Xcode</a></li><li class="tag-list-item"><a class="tag-list-link" href="/tags/iOS/">iOS</a></li></ul>
</div>
</section>
<section class="switch-part switch-part3">
<div id="js-friends">
<a class="main-nav-link switch-friends-link" href="https://hexo.io">Hexo</a>
<a class="main-nav-link switch-friends-link" href="https://pages.github.com/">GitHub</a>
<a class="main-nav-link switch-friends-link" href="http://moxfive.xyz/">MOxFIVE</a>
<a class="main-nav-link switch-friends-link" href="http://charles.iiilab.com/">Charles</a>
</div>
</section>
<section class="switch-part switch-part4">
<div id="js-aboutme">專注於 iOS App</div>
</section>
</div>
</div>
</header>
</div>
</div>
<div class="mid-col">
<nav id="mobile-nav">
<div class="overlay">
<div class="slider-trigger"></div>
<h1 class="header-author js-mobile-header hide"><a href="/" title="回到主页">Tin</a></h1>
</div>
<div class="intrude-less">
<header id="header" class="inner">
<a href="/" class="profilepic">
<img src="/img/avatar.png" class="animated zoomIn">
</a>
<hgroup>
<h1 class="header-author"><a href="/" title="回到主页">Tin</a></h1>
</hgroup>
<p class="header-subtitle">星星給予仰望者光芒</p>
<nav class="header-menu">
<ul>
<li><a href="/">主頁</a></li>
<li><a href="/archives/">所有文章</a></li>
<li><a href="/tags/">標籤</a></li>
<li><a href="/about/">關於我</a></li>
<div class="clearfix"></div>
</ul>
</nav>
<nav class="header-nav">
<ul class="social">
<a class="fa Email" target="_blank" href="mailto:[email protected]" title="Email"></a>
<a class="fa GitHub" target="_blank" href="https://github.com/s2339956" title="GitHub"></a>
<a class="fa RSS" target="_blank" href="/atom.xml" title="RSS"></a>
<a class="fa 微信" target="_blank" href="/s2339956" title="微信"></a>
<a class="fa Instagram" target="_blank" href="https://www.instagram.com/s2339956/" title="Instagram"></a>
</ul>
</nav>
</header>
</div>
<link class="menu-list" tags="標籤" friends="友情連結" about="關於我"/>
</nav>
<div class="body-wrap"><article id="post-markdown-table-style" class="article article-type-post" itemscope itemprop="blogPost">
<div class="article-meta">
<a href="/markdown-table-style.html" class="article-date">
<time datetime="2017-11-15T12:39:17.000Z" itemprop="datePublished">2017-11-15</time>
</a>
</div>
<div class="article-inner">
<input type="hidden" class="isFancy" />
<header class="article-header">
<h1 class="article-title" itemprop="name">
Markdown 表格樣式調整與自適應優化
</h1>
</header>
<div class="article-info article-info-post">
<div class="article-tag tagcloud">
<ul class="article-tag-list"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/CSS/">CSS</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/">JavaScript</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Markdown/">Markdown</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Table/">Table</a></li></ul>
</div>
<div class="clearfix"></div>
</div>
<div class="article-entry" itemprop="articleBody">
<p> Markdown 寫的表格最終會被解析成 HTML 格式,如果使用的編輯器支持自定義 CSS,就能方便的調整樣式。如果可以引入 JavaScript,樣式自適應也能較好地實現。</p>
<a id="more"></a>
<p></p><p data-height="300" data-theme-id="0" data-slug-hash="ONyKqb" data-default-tab="css" data-user="MOxFIVE" class="codepen">See the Pen <a href="http://codepen.io/MOxFIVE/pen/ONyKqb/" target="_blank" rel="external">Table style</a> by MOxFIVE (<a href="http://codepen.io/MOxFIVE" target="_blank" rel="external">@MOxFIVE</a>) on <a href="http://codepen.io" target="_blank" rel="external">CodePen</a>.</p><p></p>
<script async src="//assets.codepen.io/assets/embed/ei.js"></script>
<h2 id="樣式調整"><a href="#樣式調整" class="headerlink" title="樣式調整"></a>樣式調整</h2><h3 id="基礎概念"><a href="#基礎概念" class="headerlink" title="基礎概念"></a>基礎概念</h3><pre><code><table>: 表格
<thead>: table header 表頭區
<th>: table headings 表頭單元格内容
<tbody>: table body 表格内容區
<tr>: table row 表行
<td>: table data 單元格内容
</code></pre><h3 id="基本樣式"><a href="#基本樣式" class="headerlink" title="基本樣式"></a>基本樣式</h3><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">table</span> {</span><br><span class="line"> <span class="attribute">width</span>: <span class="number">100%</span>; <span class="comment">/*表格寬度*/</span></span><br><span class="line"> <span class="attribute">max-width</span>: <span class="number">65em</span>; <span class="comment">/*表格最大寬度,避免表格過寬*/</span></span><br><span class="line"> <span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#dedede</span>; <span class="comment">/*表格外邊框設置*/</span></span><br><span class="line"> <span class="attribute">margin</span>: <span class="number">15px</span> auto; <span class="comment">/*外邊距*/</span></span><br><span class="line"> <span class="attribute">border-collapse</span>: collapse; <span class="comment">/*使用單一線條的邊框*/</span></span><br><span class="line"> <span class="attribute">empty-cells</span>: show; <span class="comment">/*單元格無内容依舊繪製邊框*/</span></span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="selector-tag">table</span> <span class="selector-tag">th</span>,</span><br><span class="line"><span class="selector-tag">table</span> <span class="selector-tag">td</span> {</span><br><span class="line"> <span class="attribute">height</span>: <span class="number">35px</span>; <span class="comment">/*統一每一行的默認高度*/</span></span><br><span class="line"> <span class="attribute">border</span>: <span class="number">1px</span> solid <span class="number">#dedede</span>; <span class="comment">/*内部邊框樣式*/</span></span><br><span class="line"> <span class="attribute">padding</span>: <span class="number">0</span> <span class="number">10px</span>; <span class="comment">/*内邊距*/</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="表頭樣式"><a href="#表頭樣式" class="headerlink" title="表頭樣式"></a>表頭樣式</h3><figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">table</span> <span class="selector-tag">th</span> {</span><br><span class="line"> <span class="attribute">font-weight</span>: bold; <span class="comment">/*加粗*/</span></span><br><span class="line"> <span class="attribute">text-align</span>: center <span class="meta">!important</span>; <span class="comment">/*内容居中,加上 !important 避免被 Markdown 樣式覆蓋*/</span></span><br><span class="line"> <span class="attribute">background</span>: <span class="built_in">rgba</span>(158,188,226,0.2); <span class="comment">/*背景色*/</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="隔行變色"><a href="#隔行變色" class="headerlink" title="隔行變色"></a>隔行變色</h3><ul>
<li>使用選擇器選取復數行設置背景色。一般 Markdown 表格編譯後都有 <code><tbody></code> 包裹内容,那下面就相當於從表格第二行開始技術</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">table</span> <span class="selector-tag">tbody</span> <span class="selector-tag">tr</span><span class="selector-pseudo">:nth-child(2n)</span> {</span><br><span class="line"> <span class="attribute">background</span>: <span class="built_in">rgba</span>(158,188,226,0.12);</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="懸浮變色"><a href="#懸浮變色" class="headerlink" title="懸浮變色"></a>懸浮變色</h3><ul>
<li>滑鼠懸浮時該行改變背景色</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">table</span> <span class="selector-tag">tr</span><span class="selector-pseudo">:hover</span> {</span><br><span class="line"> <span class="attribute">background</span>: <span class="number">#efefef</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h2 id="自適應優化"><a href="#自適應優化" class="headerlink" title="自適應優化"></a>自適應優化</h2><p>表格用 Markdown 書寫,編輯器解析,因而只能在已經生成好的程式碼上進行自適應優化。</p>
<h3 id="表頭不換行"><a href="#表頭不換行" class="headerlink" title="表頭不換行"></a>表頭不換行</h3><ul>
<li>設置表頭單元格内容不換行,這樣可以通過表頭控制該列的最小寬度,避免瀏覽器視窗缩小時内容被壓縮得太緊</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">table</span> <span class="selector-tag">th</span> {</span><br><span class="line"> <span class="attribute">white-space</span>: nowrap; <span class="comment">/*表頭内容強制在一行顯示*/</span></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="首列不換行"><a href="#首列不換行" class="headerlink" title="首列不換行"></a>首列不換行</h3><ul>
<li>表格第一列單元格内容不換行,多數情况下表格首列不應該被壓縮換行</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">table</span> <span class="selector-tag">td</span><span class="selector-pseudo">:nth-child(1)</span> {</span><br><span class="line"> <span class="attribute">white-space</span>: nowrap;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="表格滾動條"><a href="#表格滾動條" class="headerlink" title="表格滾動條"></a>表格滾動條</h3><ul>
<li>添加 JavaScript 代碼,用一個 <code><div></code> 把表格包裹起来,父元素寬度不足時顯示横向滾動條,避免表格撑破布局</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">[].slice.call(<span class="built_in">document</span>.querySelectorAll(<span class="string">'table'</span>)).forEach(<span class="function"><span class="keyword">function</span>(<span class="params">el</span>)</span>{</span><br><span class="line"> <span class="keyword">var</span> wrapper = <span class="built_in">document</span>.createElement(<span class="string">'div'</span>);</span><br><span class="line"> wrapper.className = <span class="string">'table-area'</span>;</span><br><span class="line"> el.parentNode.insertBefore(wrapper, el);</span><br><span class="line"> el.parentNode.removeChild(el);</span><br><span class="line"> wrapper.appendChild(el);</span><br><span class="line">})</span><br></pre></td></tr></table></figure>
<ul>
<li>jQuery</li>
</ul>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$(<span class="string">"table"</span>).wrap(<span class="string">"<div class='table-area'></div>"</span>);</span><br></pre></td></tr></table></figure>
<ul>
<li>同时添加如下 CSS</li>
</ul>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-class">.table-area</span> {</span><br><span class="line"> <span class="attribute">overflow</span>: auto;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<ul>
<li>To be added</li>
</ul>
</div>
</div>
<div class="copyright">
<p><span>本文標題:</span><a href="/markdown-table-style.html">Markdown 表格樣式調整與自適應優化</a></p>
<p><span>文章作者:</span><a href="/" title="回到主頁">Tin</a></p>
<p><span>發布時間:</span>2017-11-15, 20:39:17</p>
<p><span>最後更新:</span>2017-11-15, 18:09:40</p>
<p>
<span>原始連結:</span><a class="post-url" href="/markdown-table-style.html" title="Markdown 表格樣式調整與自適應優化">http://s2339956.github.io/markdown-table-style.html</a>
<span class="copy-path" data-clipboard-text="原文: http://s2339956.github.io/markdown-table-style.html 作者: Tin" title="點擊複製文章連結"><i class="fa fa-clipboard"></i></span>
<script> var clipboard = new Clipboard('.copy-path'); </script>
</p>
<p>
<span>許可協議:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" title="CC BY-NC-SA 4.0 International" target = "_blank">"姓名標示-非商業性-相同方式分享 4.0 國際"</a> 轉載請保留原文連結及作者。
</p>
</div>
<nav id="article-nav">
<div id="article-nav-newer" class="article-nav-title">
<a href="/xcode.html">
Xcode 中斷點 簡介
</a>
</div>
<div id="article-nav-older" class="article-nav-title">
<a href="/常用-Hexo-指令.html">
常用 Hexo 指令
</a>
</div>
</nav>
</article>
<div id="toc" class="toc-article">
<strong class="toc-title">文章目錄</strong>
<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#樣式調整"><span class="toc-number">1.</span> <span class="toc-text">樣式調整</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#基礎概念"><span class="toc-number">1.1.</span> <span class="toc-text">基礎概念</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#基本樣式"><span class="toc-number">1.2.</span> <span class="toc-text">基本樣式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#表頭樣式"><span class="toc-number">1.3.</span> <span class="toc-text">表頭樣式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#隔行變色"><span class="toc-number">1.4.</span> <span class="toc-text">隔行變色</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#懸浮變色"><span class="toc-number">1.5.</span> <span class="toc-text">懸浮變色</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#自適應優化"><span class="toc-number">2.</span> <span class="toc-text">自適應優化</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#表頭不換行"><span class="toc-number">2.1.</span> <span class="toc-text">表頭不換行</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#首列不換行"><span class="toc-number">2.2.</span> <span class="toc-text">首列不換行</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#表格滾動條"><span class="toc-number">2.3.</span> <span class="toc-text">表格滾動條</span></a></li></ol></li></ol>
</div>
<style>
.left-col .switch-btn,
.left-col .switch-area {
display: none;
}
.toc-level-3 i,
.toc-level-3 ol {
display: none !important;
}
</style>
<input type="button" id="tocButton" value="隱藏目錄" title="點擊按鈕隱藏或者顯示文章目錄">
<script>
yiliaConfig.toc = ["隱藏目錄", "顯示目錄", !!"false"];
</script>
<div class="share">
<div class="bdsharebuttonbox">
<a href="#" class="fa fa-twitter bds_twi" data-cmd="twi" title="分享到Twitter"></a>
<a href="#" class="fa fa-weibo bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
<a href="#" class="fa fa-qq bds_sqq" data-cmd="sqq" title="分享給QQ好友"></a>
<a href="#" class="fa fa-files-o bds_copy" data-cmd="copy" title="複製網址"></a>
<a href="#" class="fa fa fa-envelope-o bds_mail" data-cmd="mail" title="透過郵件分享"></a>
<a href="#" class="fa fa-weixin bds_weixin" data-cmd="weixin" title="生成文章QRcode"></a>
<a href="#" class="fa fa-share-alt bds_more" data-cmd="more"></i></a>
</div>
<script>
window._bd_share_config={
"common":{"bdSnsKey":{},"bdText":"Markdown 表格樣式調整與自適應優化 | Tin Blog ","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"24"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
</div>
<section id="comments">
<style> aside.comment-bar { margin: auto 30px; }</style>
<div id="disqus_thread"></div>
<script>
var disqus_config = function(){
this.page.url = 'http://s2339956.github.io/markdown-table-style.html';
this.page.identifier = 'markdown-table-style.html';
};
var loadComment = function(){
var d = document, s = d.createElement('script');
s.src = '//s2339956.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
}
</script>
<aside class="comment-bar">
<a href="javascript:void(0);">
<i class="fa fa-commenting-o animated infinite pulse"></i>
<i class="fa fa-spinner fa-pulse"></i>
<span class="count-comment"></span>
</a>
</aside>
<script>
var $commentBar = $("#comments aside.comment-bar");
var load$hide = function(){
$commentBar.find("a > i").toggle();
loadComment();
$commentBar.fadeOut(800);
}
$commentBar.click(function(){
load$hide();
})
$commentBar.children("a").hover(function(){
load$hide();
})
if (window.location.hash === "#comments") {
load$hide();
}
</script>
</section>
// Add comment count
<script id="dsq-count-scr" src="//s2339956.disqus.com/count.js" async></script>
<span class="disqus-comment-count" data-disqus-identifier="markdown-table-style.html"></span>
<span class="disqus-comment-count" data-disqus-url="http://s2339956.github.io/markdown-table-style.html"></span>
<script>
$(".disqus-comment-count").hide();
var $disqusCount = $(".disqus-comment-count");
$disqusCount.bind("DOMNodeInserted", function(e) {
$(".count-comment").text(
$(this).text().replace(/[^0-9]/ig,"")
)
DISQUSWIDGETS.getCount({reset: true});
})
</script>
<div class="scroll" id="post-nav-button">
<a href="/xcode.html" title="上一篇: Xcode 中斷點 簡介">
<i class="fa fa-angle-left"></i>
</a>
<a title="文章列表"><i class="fa fa-bars"></i><i class="fa fa-times"></i></a>
<a href="/常用-Hexo-指令.html" title="下一篇: 常用 Hexo 指令">
<i class="fa fa-angle-right"></i>
</a>
</div>
<ul class="post-list"><li class="post-list-item"><a class="post-list-link" href="/Python 開發必備神器之一:virtualenv.html">Python 開發必備神器之一:virtualenv</a></li><li class="post-list-item"><a class="post-list-link" href="/跳過iOS網頁視頻廣告,這樣就可以簡單做到.html">跳過iOS網頁視頻廣告,這樣就可以簡單做到</a></li><li class="post-list-item"><a class="post-list-link" href="/Reveal14 使用.html">Reveal 14版 環境搭建</a></li><li class="post-list-item"><a class="post-list-link" href="/Xcode-lldb-小技能.html">Xcode lldb 小技能</a></li><li class="post-list-item"><a class="post-list-link" href="/2017-11-19-21-37.html">2017-11-19-21:37</a></li><li class="post-list-item"><a class="post-list-link" href="/Python.html">Python join 語法使用</a></li><li class="post-list-item"><a class="post-list-link" href="/Obj-C-動態取得-Class-屬性名稱-and-屬性質值.html">Obj-C 動態取得 Class 屬性名稱 and 屬性質值</a></li><li class="post-list-item"><a class="post-list-link" href="/xcode.html">Xcode 中斷點 簡介</a></li><li class="post-list-item"><a class="post-list-link" href="/markdown-table-style.html">Markdown 表格樣式調整與自適應優化</a></li><li class="post-list-item"><a class="post-list-link" href="/常用-Hexo-指令.html">常用 Hexo 指令</a></li></ul>
<script>
</script>
</div>
<footer id="footer">
<div class="outer">
<div id="footer-info">
<div class="footer-left">
<i class="fa fa-copyright"></i>
2017-2018 Tin
</div>
<div class="footer-right">
<a href="http://hexo.io/" target="_blank" title="快速、簡單且強大的網誌框架">Hexo</a> Theme <a href="https://github.com/MOxFIVE/hexo-theme-yelee" target="_blank" title="簡而不減 Hexo 雙欄網誌主題 v3.5">Yelee</a> by MOxFIVE <i class="fa fa-heart animated infinite pulse"></i>
</div>
</div>
<div class="visit">
<span id="busuanzi_container_site_pv" style='display:none'>
<span id="site-visit" title="本站到訪數"><i class="fa fa-user" aria-hidden="true"></i><span id="busuanzi_value_site_uv"></span>
</span>
</span>
<span>| </span>
<span id="busuanzi_container_page_pv" style='display:none'>
<span id="page-visit" title="本頁閱讀量"><i class="fa fa-eye animated infinite pulse" aria-hidden="true"></i><span id="busuanzi_value_page_pv"></span>
</span>
</span>
</div>
</div>
</footer>
</div>
<script data-main="/js/main.js" src="//cdn.bootcss.com/require.js/2.2.0/require.min.js"></script>
<script>
$(document).ready(function() {
var iPad = window.navigator.userAgent.indexOf('iPad');
if (iPad > -1 || $(".left-col").css("display") === "none") {
var bgColorList = ["#9db3f4", "#414141", "#e5a859", "#f5dfc6", "#c084a0", "#847e72", "#cd8390", "#996731"];
var bgColor = Math.ceil(Math.random() * (bgColorList.length - 1));
$("body").css({"background-color": bgColorList[bgColor], "background-size": "cover"});
}
else {
var backgroundnum = 5;
var backgroundimg = "url(/background/bg-x.jpg)".replace(/x/gi, Math.ceil(Math.random() * backgroundnum));
$("body").css({"background": backgroundimg, "background-attachment": "fixed", "background-size": "cover"});
}
})
</script>
<!-- Google Analytics -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-109722991-1', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<div class="scroll" id="scroll">
<a href="#" title="返回頂部"><i class="fa fa-arrow-up"></i></a>
<a href="#comments" onclick="load$hide();" title="查看評論"><i class="fa fa-comments-o"></i></a>
<a href="#footer" title="轉到底部"><i class="fa fa-arrow-down"></i></a>
</div>
<script>
// Open in New Window
var oOpenInNew = {
archives: ".archive-article-title",
miniArchives: "a.post-list-link",
friends: "#js-friends a",
socail: ".social a"
}
for (var x in oOpenInNew) {
$(oOpenInNew[x]).attr("target", "_blank");
}
</script>
<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js">
</script>
</div>
</body>
</html>