最近在仿写12306火车票查询页面。将12306网站的样式取了下来,其静态页面显示正常,但是通过ajax调用后台数据,再通过append回显却出现了表格挤压的情况。
1、正常显示页面如下:
html代码:
ディスカッションへの返信 (解決策) 要素を検査し、構造とスタイルを確認してください
要素をレビューしたときに表示されるhtmlは次のとおりです:
<tbody id="_query_table_datas" style="display: block;"><tr class="bgc" id="ticket_G6260"><td colspan="4" width="370"><div class="ticket-info clearfix" id="train_num_1"><div class="train"><div><a title="点击查看停靠站信息" onclick="myStopStation.open('1','65000C704001','SZQ','GGQ','20151023','3')" href="javascript:" class="number">G6260</a></div><span onclick="$.showTicketPrice('65000C704001','无')" class="lookup" id="65000C704001_01_05_OMO" title="查看票价" style="cursor: pointer;"><b style="cursor: pointer;"></b></span></div><div class="cdz"> <strong class="start-s">深圳北</strong> <strong class="end-s">广州南</strong></div><div class="cds"><strong class="start-t">22:26</strong> <strong class="color999">23:02</strong></div><div class="ls"><strong>00:36</strong> <span class="color999">当日到达</span></div></div></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">9</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">无</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">6</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">6</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">75</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td class="no-br"><span class="color999"></span></td></tr><tr style="display: none;" id="price_65000C712401"></tr><tr class="bgc" id="ticket_C7124"><td colspan="4" width="370"><div class="ticket-info clearfix" id="train_num_2"><div class="train"><div><a title="点击查看停靠站信息" onclick="myStopStation.open('1','65000C704001','SZQ','GGQ','20151023','3')" href="javascript:" class="number">C7124</a></div><span onclick="$.showTicketPrice('65000C704001','无')" class="lookup" id="65000C704001_01_05_OMO" title="查看票价" style="cursor: pointer;"><b style="cursor: pointer;"></b></span></div><div class="cdz"> <strong class="start-s">深圳</strong> <strong class="end-s">广州东</strong></div><div class="cds"><strong class="start-t">22:38</strong> <strong class="color999">23:50</strong></div><div class="ls"><strong>1小时12分</strong> <span class="color999">当日到达</span></div></div></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">107</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">107</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">无</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="no-br" width="49"><span class="color999"></span></td></tr><tr id="price_65000C712401" style="display: none;"></tr><tr class="bgc" id="ticket_G6330"><td colspan="4" width="370"><div class="ticket-info clearfix" id="train_num_3"><div class="train"><div><a title="点击查看停靠站信息" onclick="myStopStation.open('1','65000C704001','SZQ','GGQ','20151023','3')" href="javascript:" class="number">G6330</a></div><span onclick="$.showTicketPrice('65000C704001','无')" class="lookup" id="65000C704001_01_05_OMO" title="查看票价" style="cursor: pointer;"><b style="cursor: pointer;"></b></span></div><div class="cdz"> <strong class="start-s">深圳北</strong> <strong class="end-s">广州南</strong></div><div class="cds"><strong class="start-t">23:03</strong> <strong class="color999">23:32</strong></div><div class="ls"><strong>00:29</strong> <span class="color999">当日到达</span></div></div></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">无</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">无</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">无</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">无</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">57</span></td><td style="white-space: nowrap;width=49px;" class="cursor" onclick="$.showTicketPrice('65000C704001','无')" width="49"><span class="color999">--</span></td><td style="white-space: nowrap;width=49px;" class="no-br" width="49"><span class="color999"></span></td></tr><tr id="price_65000C712401" style="display: none;"></tr></tbody>
tdのスタイルはwidthが反映されないため、この方法で改善しようとしましたが、結果は無効でした。
style="white-space: nowrap;width=49px;"