2017-07-11 14 views
-1

テーブルと段落を動的に表示していますが、段落と表の間のスペースをどのように削除できますか?私は余白とパディング0を実行して、それを試してみましたが、それでもスペースがあり、以下の段落と段落の間のスペースを取り除く方法

が私のコードです:

var out = "<br/><p>&nbsp&nbsp&nbsp&nbspConfirmed Batches</p>"; 
 
//var out=""; 
 
//out+="<center><table><tr><td>Confirmed Batches</td></tr></table>; 
 
out += "<table border='2' cellpadding='1' cellspacing='0' rules=none >"; 
 
//out+="<tr><td>Confirmed Batches</td></tr>"; 
 
out += "<tr><th width='100' height='40' >&nbsp&nbspBatch Code</th><th width='100' height='45'><center>Start Date</center></th><th width='50' align='center' height='45'><center>Day</center></th><th width='120' align='center' height='45'><center>Batch time</center></th><th width='150' align='center' height='45'><center>Trainer</center></th><th width='100' align='center' height='45'><center>Frequency</center></th><th width='50' align='center' height='45' ><center>Fees</center></th><th width='110' align='center' height='45'><center>Duration</center></th></th></tr>"; 
 
$("body").append(out);
table { 
 
    //border:5; 
 
    margin-left: 20px; 
 
    margin-top: 0px; 
 
    margin-bottom: 0px; 
 
    width: 800px; 
 
    border-collapse: collapse; 
 
    border-spacing: 0; 
 
    //border-color:green; 
 
    //background-color:#EBF5FB; 
 
} 
 

 
p { 
 
    margin-bottom: 0px; 
 
    margin-top: 0px; 
 
    font-size: 15px; 
 
    color: #C8E786; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

+3

スタックスニペット( '[<]]'ツールバーボタン)*を使用して問題を表示して、** runnable ** [mcve]で質問を更新してください。 –

+0

問題を再現するコードを提供します。 –

+0

あなたのためにスニペットを作成しました。それは何も問題を表示していません – mplungjan

答えて

0

おそらく、あなたは

th { 
 
    height: 45px; 
 
    text-align: center; 
 
}
<fieldset> 
 
    <legend>Confirmed Batches</legend> 
 
    <table cellpadding='1' cellspacing='0' rules=none> 
 

 
    <tr> 
 
     <th width='100'>Batch Code</th> 
 
     <th width='100'>Start Date</th> 
 
     <th width='50'>Day</th> 
 
     <th width='120'>Batch time</th> 
 
     <th width='150'>Trainer</th> 
 
     <th width='100'>Frequency</th> 
 
     <th width='50'>Fees</th> 
 
     <th width='110'>Duration</th> 
 
    </tr> 
 
    </table> 
 
</fieldset>

を意味します
関連する問題