table中thead固定一直在最上面
Posted 随风飞起-英
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了table中thead固定一直在最上面相关的知识,希望对你有一定的参考价值。
<link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
<link href="css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="css/animate.min.css" rel="stylesheet">
<link href="css/style.min.css?v=4.0.0" rel="stylesheet">
<div class="fixed-table-container" style="height: 341px; padding-bottom: 36px;"><div class="fixed-table-header" style="margin-right: 6px;"><table class="table table-hover" style="width: 2828px;"><thead><tr><th style="" data-field="字段0" tabindex="0"><div class="th-inner ">单元0</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段1" tabindex="0"><div class="th-inner ">单元1</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段2" tabindex="0"><div class="th-inner ">单元2</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段3" tabindex="0"><div class="th-inner ">单元3</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段4" tabindex="0"><div class="th-inner ">单元4</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段5" tabindex="0"><div class="th-inner ">单元5</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段6" tabindex="0"><div class="th-inner ">单元6</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段7" tabindex="0"><div class="th-inner ">单元7</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段8" tabindex="0"><div class="th-inner ">单元8</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段9" tabindex="0"><div class="th-inner ">单元9</div><div class="fht-cell" style="width: 50px;"></div></th><th style="" data-field="字段10" tabindex="0"><div class="th-inner ">单元10</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段11" tabindex="0"><div class="th-inner ">单元11</div><div class="fht-cell" style="width: 56px;"></div></th><th style="" data-field="字段12" tabindex="0"><div class="th-inner ">单元12</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段13" tabindex="0"><div class="th-inner ">单元13</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段14" tabindex="0"><div class="th-inner ">单元14</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段15" tabindex="0"><div class="th-inner ">单元15</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段16" tabindex="0"><div class="th-inner ">单元16</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段17" tabindex="0"><div class="th-inner ">单元17</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段18" tabindex="0"><div class="th-inner ">单元18</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段19" tabindex="0"><div class="th-inner ">单元19</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段20" tabindex="0"><div class="th-inner ">单元20</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段21" tabindex="0"><div class="th-inner ">单元21</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段22" tabindex="0"><div class="th-inner ">单元22</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段23" tabindex="0"><div class="th-inner ">单元23</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段24" tabindex="0"><div class="th-inner ">单元24</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段25" tabindex="0"><div class="th-inner ">单元25</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段26" tabindex="0"><div class="th-inner ">单元26</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段27" tabindex="0"><div class="th-inner ">单元27</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段28" tabindex="0"><div class="th-inner ">单元28</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段29" tabindex="0"><div class="th-inner ">单元29</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段30" tabindex="0"><div class="th-inner ">单元30</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段31" tabindex="0"><div class="th-inner ">单元31</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段32" tabindex="0"><div class="th-inner ">单元32</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段33" tabindex="0"><div class="th-inner ">单元33</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段34" tabindex="0"><div class="th-inner ">单元34</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段35" tabindex="0"><div class="th-inner ">单元35</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段36" tabindex="0"><div class="th-inner ">单元36</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段37" tabindex="0"><div class="th-inner ">单元37</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段38" tabindex="0"><div class="th-inner ">单元38</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段39" tabindex="0"><div class="th-inner ">单元39</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段40" tabindex="0"><div class="th-inner ">单元40</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段41" tabindex="0"><div class="th-inner ">单元41</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段42" tabindex="0"><div class="th-inner ">单元42</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段43" tabindex="0"><div class="th-inner ">单元43</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段44" tabindex="0"><div class="th-inner ">单元44</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段45" tabindex="0"><div class="th-inner ">单元45</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段46" tabindex="0"><div class="th-inner ">单元46</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段47" tabindex="0"><div class="th-inner ">单元47</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段48" tabindex="0"><div class="th-inner ">单元48</div><div class="fht-cell" style="width: 57px;"></div></th><th style="" data-field="字段49" tabindex="0"><div class="th-inner ">单元49</div><div class="fht-cell" style="width: 57px;"></div></th></tr></thead></table></div><div class="fixed-table-body"><table id="exampleTableLargeColumns" data-show-columns="true" data-height="400" data-mobile-responsive="true" class="table table-hover" style="margin-top: -36px;"><thead><tr><th style="" data-field="字段0" tabindex="0"><div class="th-inner ">单元0</div><div class="fht-cell"></div></th><th style="" data-field="字段1" tabindex="0"><div class="th-inner ">单元1</div><div class="fht-cell"></div></th><th style="" data-field="字段2" tabindex="0"><div class="th-inner ">单元2</div><div class="fht-cell"></div></th><th style="" data-field="字段3" tabindex="0"><div class="th-inner ">单元3</div><div class="fht-cell"></div></th><th style="" data-field="字段4" tabindex="0"><div class="th-inner ">单元4</div><div class="fht-cell"></div></th><th style="" data-field="字段5" tabindex="0"><div class="th-inner ">单元5</div><div class="fht-cell"></div></th><th style="" data-field="字段6" tabindex="0"><div class="th-inner ">单元6</div><div class="fht-cell"></div></th><th style="" data-field="字段7" tabindex="0"><div class="th-inner ">单元7</div><div class="fht-cell"></div></th><th style="" data-field="字段8" tabindex="0"><div class="th-inner ">单元8</div><div class="fht-cell"></div></th><th style="" data-field="字段9" tabindex="0"><div class="th-inner ">单元9</div><div class="fht-cell"></div></th><th style="" data-field="字段10" tabindex="0"><div class="th-inner ">单元10</div><div class="fht-cell"></div></th><th style="" data-field="字段11" tabindex="0"><div class="th-inner ">单元11</div><div class="fht-cell"></div></th><th style="" data-field="字段12" tabindex="0"><div class="th-inner ">单元12</div><div class="fht-cell"></div></th><th style="" data-field="字段13" tabindex="0"><div class="th-inner ">单元13</div><div class="fht-cell"></div></th><th style="" data-field="字段14" tabindex="0"><div class="th-inner ">单元14</div><div class="fht-cell"></div></th><th style="" data-field="字段15" tabindex="0"><div class="th-inner ">单元15</div><div class="fht-cell"></div></th><th style="" data-field="字段16" tabindex="0"><div class="th-inner ">单元16</div><div class="fht-cell"></div></th><th style="" data-field="字段17" tabindex="0"><div class="th-inner ">单元17</div><div class="fht-cell"></div></th><th style="" data-field="字段18" tabindex="0"><div class="th-inner ">单元18</div><div class="fht-cell"></div></th><th style="" data-field="字段19" tabindex="0"><div class="th-inner ">单元19</div><div class="fht-cell"></div></th><th style="" data-field="字段20" tabindex="0"><div class="th-inner ">单元20</div><div class="fht-cell"></div></th><th style="" data-field="字段21" tabindex="0"><div class="th-inner ">单元21</div><div class="fht-cell"></div></th><th style="" data-field="字段22" tabindex="0"><div class="th-inner ">单元22</div><div class="fht-cell"></div></th><th style="" data-field="字段23" tabindex="0"><div class="th-inner ">单元23</div><div class="fht-cell"></div></th><th style="" data-field="字段24" tabindex="0"><div class="th-inner ">单元24</div><div class="fht-cell"></div></th><th style="" data-field="字段25" tabindex="0"><div class="th-inner ">单元25</div><div class="fht-cell"></div></th><th style="" data-field="字段26" tabindex="0"><div class="th-inner ">单元26</div><div class="fht-cell"></div></th><th style="" data-field="字段27" tabindex="0"><div class="th-inner ">单元27</div><div class="fht-cell"></div></th><th style="" data-field="字段28" tabindex="0"><div class="th-inner ">单元28</div><div class="fht-cell"></div></th><th style="" data-field="字段29" tabindex="0"><div class="th-inner ">单元29</div><div class="fht-cell"></div></th><th style="" data-field="字段30" tabindex="0"><div class="th-inner ">单元30</div><div class="fht-cell"></div></th><th style="" data-field="字段31" tabindex="0"><div class="th-inner ">单元31</div><div class="fht-cell"></div></th><th style="" data-field="字段32" tabindex="0"><div class="th-inner ">单元32</div><div class="fht-cell"></div></th><th style="" data-field="字段33" tabindex="0"><div class="th-inner ">单元33</div><div class="fht-cell"></div></th><th style="" data-field="字段34" tabindex="0"><div class="th-inner ">单元34</div><div class="fht-cell"></div></th><th style="" data-field="字段35" tabindex="0"><div class="th-inner ">单元35</div><div class="fht-cell"></div></th><th style="" data-field="字段36" tabindex="0"><div class="th-inner ">单元36</div><div class="fht-cell"></div></th><th style="" data-field="字段37" tabindex="0"><div class="th-inner ">单元37</div><div class="fht-cell"></div></th><th style="" data-field="字段38" tabindex="0"><div class="th-inner ">单元38</div><div class="fht-cell"></div></th><th style="" data-field="字段39" tabindex="0"><div class="th-inner ">单元39</div><div class="fht-cell"></div></th><th style="" data-field="字段40" tabindex="0"><div class="th-inner ">单元40</div><div class="fht-cell"></div></th><th style="" data-field="字段41" tabindex="0"><div class="th-inner ">单元41</div><div class="fht-cell"></div></th><th style="" data-field="字段42" tabindex="0"><div class="th-inner ">单元42</div><div class="fht-cell"></div></th><th style="" data-field="字段43" tabindex="0"><div class="th-inner ">单元43</div><div class="fht-cell"></div></th><th style="" data-field="字段44" tabindex="0"><div class="th-inner ">单元44</div><div class="fht-cell"></div></th><th style="" data-field="字段45" tabindex="0"><div class="th-inner ">单元45</div><div class="fht-cell"></div></th><th style="" data-field="字段46" tabindex="0"><div class="th-inner ">单元46</div><div class="fht-cell"></div></th><th style="" data-field="字段47" tabindex="0"><div class="th-inner ">单元47</div><div class="fht-cell"></div></th><th style="" data-field="字段48" tabindex="0"><div class="th-inner ">单元48</div><div class="fht-cell"></div></th><th style="" data-field="字段49" tabindex="0"><div class="th-inner ">单元49</div><div class="fht-cell"></div></th></tr></thead><tbody><tr data-index="0"><td style="">Row-0-0</td><td style="">Row-0-1</td><td style="">Row-0-2</td><td style="">Row-0-3</td><td style="">Row-0-4</td><td style="">Row-0-5</td><td style="">Row-0-6</td><td style="">Row-0-7</td><td style="">Row-0-8</td><td style="">Row-0-9</td><td style="">Row-0-10</td><td style="">Row-0-11</td><td style="">Row-0-12</td><td style="">Row-0-13</td><td style="">Row-0-14</td><td style="">Row-0-15</td><td style="">Row-0-16</td><td style="">Row-0-17</td><td style="">Row-0-18</td><td style="">Row-0-19</td><td style="">Row-0-20</td><td style="">Row-0-21</td><td style="">Row-0-22</td><td style="">Row-0-23</td><td style="">Row-0-24</td><td style="">Row-0-25</td><td style="">Row-0-26</td><td style="">Row-0-27</td><td style="">Row-0-28</td><td style="">Row-0-29</td><td style="">Row-0-30</td><td style="">Row-0-31</td><td style="">Row-0-32</td><td style="">Row-0-33</td><td style="">Row-0-34</td><td style="">Row-0-35</td><td style="">Row-0-36</td><td style="">Row-0-37</td><td style="">Row-0-38</td><td style="">Row-0-39</td><td style="">Row-0-40</td><td style="">Row-0-41</td><td style="">Row-0-42</td><td style="">Row-0-43</td><td style="">Row-0-44</td><td style="">Row-0-45</td><td style="">Row-0-46</td><td style="">Row-0-47</td><td style="">Row-0-48</td><td style="">Row-0-49</td></tr><tr data-index="1"><td style="">Row-1-0</td><td style="">Row-1-1</td><td style="">Row-1-2</td><td style="">Row-1-3</td><td style="">Row-1-4</td><td style="">Row-1-5</td><td style="">Row-1-6</td><td style="">Row-1-7</td><td style="">Row-1-8</td><td style="">Row-1-9</td><td style="">Row-1-10</td><td style="">Row-1-11</td><td style="">Row-1-12</td><td style="">Row-1-13</td><td style="">Row-1-14</td><td style="">Row-1-15</td><td style="">Row-1-16</td><td style="">Row-1-17</td><td style="">Row-1-18</td><td style="">Row-1-19</td><td style="">Row-1-20</td><td style="">Row-1-21</td><td style="">Row-1-22</td><td style="">Row-1-23</td><td style="">Row-1-24</td><td style="">Row-1-25</td><td style="">Row-1-26</td><td style="">Row-1-27</td><td style="">Row-1-28</td><td style="">Row-1-29</td><td style="">Row-1-30</td><td style="">Row-1-31</td><td style="">Row-1-32</td><td style="">Row-1-33</td><td style="">Row-1-34</td><td style="">Row-1-35</td><td style="">Row-1-36</td><td style="">Row-1-37</td><td style="">Row-1-38</td><td style="">Row-1-39</td><td style="">Row-1-40</td><td style="">Row-1-41</td><td style="">Row-1-42</td><td style="">Row-1-43</td><td style="">Row-1-44</td><td style="">Row-1-45</td><td style="">Row-1-46</td><td style="">Row-1-47</td><td style="">Row-1-48</td><td style="">Row-1-49</td></tr><tr data-index="2"><td style="">Row-2-0</td><td style="">Row-2-1</td><td style="">Row-2-2</td><td style="">Row-2-3</td><td style="">Row-2-4</td><td style="">Row-2-5</td><td style="">Row-2-6</td><td style="">Row-2-7</td><td style="">Row-2-8</td><td style="">Row-2-9</td><td style="">Row-2-10</td><td style="">Row-2-11</td><td style="">Row-2-12</td><td style="">Row-2-13</td><td style="">Row-2-14</td><td style="">Row-2-15</td><td style="">Row-2-16</td><td style="">Row-2-17</td><td style="">Row-2-18</td><td style="">Row-2-19</td><td style="">Row-2-20</td><td style="">Row-2-21</td><td style="">Row-2-22</td><td style="">Row-2-23</td><td style="">Row-2-24</td><td style="">Row-2-25</td><td style="">Row-2-26</td><td style="">Row-2-27</td><td style="">Row-2-28</td><td style="">Row-2-29</td><td style="">Row-2-30</td><td style="">Row-2-31</td><td style="">Row-2-32</td><td style="">Row-2-33</td><td style="">Row-2-34</td><td style="">Row-2-35</td><td style="">Row-2-36</td><td style="">Row-2-37</td><td style="">Row-2-38</td><td style="">Row-2-39</td><td style="">Row-2-40</td><td style="">Row-2-41</td><td style="">Row-2-42</td><td style="">Row-2-43</td><td style="">Row-2-44</td><td style="">Row-2-45</td><td style="">Row-2-46</td><td style="">Row-2-47</td><td style="">Row-2-48</td><td style="">Row-2-49</td></tr><tr data-index="3"><td style="">Row-3-0</td><td style="">Row-3-1</td><td style="">Row-3-2</td><td style="">Row-3-3</td><td style="">Row-3-4</td><td style="">Row-3-5</td><td style="">Row-3-6</td><td style="">Row-3-7</td><td style="">Row-3-8</td><td style="">Row-3-9</td><td style="">Row-3-10</td><td style="">Row-3-11</td><td style="">Row-3-12</td><td style="">Row-3-13</td><td style="">Row-3-14</td><td style="">Row-3-15</td><td style="">Row-3-16</td><td style="">Row-3-17</td><td style="">Row-3-18</td><td style="">Row-3-19</td><td style="">Row-3-20</td><td style="">Row-3-21</td><td style="">Row-3-22</td><td style="">Row-3-23</td><td style="">Row-3-24</td><td style="">Row-3-25</td><td style="">Row-3-26</td><td style="">Row-3-27</td><td style="">Row-3-28</td><td style="">Row-3-29</td><td style="">Row-3-30</td><td style="">Row-3-31</td><td style="">Row-3-32</td><td style="">Row-3-33</td><td style="">Row-3-34</td><td style="">Row-3-35</td><td style="">Row-3-36</td><td style="">Row-3-37</td><td style="">Row-3-38</td><td style="">Row-3-39</td><td style="">Row-3-40</td><td style="">Row-3-41</td><td style="">Row-3-42</td><td style="">Row-3-43</td><td style="">Row-3-44</td><td style="">Row-3-45</td><td style="">Row-3-46</td><td style="">Row-3-47</td><td style="">Row-3-48</td><td style="">Row-3-49</td></tr><tr data-index="4"><td style="">Row-4-0</td><td style="">Row-4-1</td><td style="">Row-4-2</td><td style="">Row-4-3</td><td style="">Row-4-4</td><td style="">Row-4-5</td><td style="">Row-4-6</td><td style="">Row-4-7</td><td style="">Row-4-8</td><td style="">Row-4-9</td><td style="">Row-4-10</td><td style="">Row-4-11</td><td style="">Row-4-12</td><td style="">Row-4-13</td><td style="">Row-4-14</td><td style="">Row-4-15</td><td style="">Row-4-16</td><td style="">Row-4-17</td><td style="">Row-4-18</td><td style="">Row-4-19</td><td style="">Row-4-20</td><td style="">Row-4-21</td><td style="">Row-4-22</td><td style="">Row-4-23</td><td style="">Row-4-24</td><td style="">Row-4-25</td><td style="">Row-4-26</td><td style="">Row-4-27</td><td style="">Row-4-28</td><td style="">Row-4-29</td><td style="">Row-4-30</td><td style="">Row-4-31</td><td style="">Row-4-32</td><td style="">Row-4-33</td><td style="">Row-4-34</td><td style="">Row-4-35</td><td style="">Row-4-36</td><td style="">Row-4-37</td><td style="">Row-4-38</td><td style="">Row-4-39</td><td style="">Row-4-40</td><td style="">Row-4-41</td><td style="">Row-4-42</td><td style="">Row-4-43</td><td style="">Row-4-44</td><td style="">Row-4-45</td><td style="">Row-4-46</td><td style="">Row-4-47</td><td style="">Row-4-48</td><td style="">Row-4-49</td></tr></tbody></table></div></div>
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.5"></script>
<script src="js/content.min.js?v=1.0.0"></script>
<script src="js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></scrip
<script src="js/demo/bootstrap-table-demo.min.js"></script>
最后效果:
以上是关于table中thead固定一直在最上面的主要内容,如果未能解决你的问题,请参考以下文章
table 表头固定 thead固定. 1) 使用jquery.freezeheader.js