2016-08-19 8 views
-1

trタグを別のtrタグに追加します。HTML-テーブル:別のtrに1つのトランク

<table width="600" align="center"> 
    <tbody> 
     <tr> 
     <td height="10" align="center" style="background-color:#f1f1f1;"></td> 
     </tr> 
     <tr> 
     <td valign="top" align="center" style=" opacity: 0.5; background: #fa4b00 no-repeat;"> 
      <table width="600" border="0" align="center"> 
       <tbody> 
        <tr> 
        <td> 
         <table width="600" align="center"> 
          <tbody> 
           <tr> 
           <td valign="top" align="center" id="1" style="color: #FFFFFF;font-family: 'Montserrat', sans-serif; line-height: 30px; letter-spacing:0.5px; text-align:center; padding-bottom: 0px; padding-left: 0px; padding-top: 60px;"> 
            <span class="wrap_textbox" style="font-weight: lighter; font-size: 26px;"> Some Text</span> 
           </td> 
           </tr> 
          </tbody> 
         </table> 
        </td> 
        </tr> 
       </tbody> 
      </table> 
     </td> 
     </tr> 
    </tbody> 
</table> 

HTMLは、私は、テキストが背景divの上になりたいです。

want some text to be on top

+0

あなたは別のテーブルの中に1つのテーブルをネストすることができます...それはあなたがここでやりたいことです... – fernando

+0

はい...しかし、私は不透明で透明な背景を持っています。そしてIDの中にはテキストがあります。しかし、私はテキストがバックグラウンドの一番上になるようにしたい。 –

+0

ネストした表から 'opacity:0.5;'を削除し、背景を '#fa4b00'から' rgba(250,75,0、.5) 'に変更してみてください。 rgbaとしてバックグラウンドカラーを指定すると、バックグラウンドでのみ不透明度を設定する必要があります。これは、要素全体とその子に対して不透明度を設定する 'opacity'プロパティとは異なります。 – antidecaf

答えて

0

私は、あなたが探しているものを実際にはわからないが、あなたは最初の背景にあなたのテキストを表示したい場合は

$(document).ready(function(){ 
 
    $(".wrap_textbox").clone().appendTo("#top"); 
 
});
table tr td table tr td .wrap_textbox{display:none;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
 

 
<table width="600" align="center"> 
 
<tbody> 
 
    <tr> 
 
    <td height="10" align="center" style="background-color:#f1f1f1;" id="top"></td> 
 
    </tr> 
 

 
    <tr> 
 
    <td valign="top" align="center" style=" opacity: 0.5; background: #fa4b00 no-repeat;"> 
 

 
<table width="600" border="0" align="center"> 
 
<tbody> 
 
<tr> 
 
<td> 
 
<table width="600" align="center"> 
 
<tbody> 
 
<tr> 
 

 
<td valign="top" align="center" id="1" style="color: #FFFFFF;font-family: 'Montserrat', sans-serif; line-height: 30px; letter-spacing:0.5px; text-align:center; padding-bottom: 0px; padding-left: 0px; padding-top: 60px;"> 
 

 
<span class="wrap_textbox" style="font-weight: lighter; font-size: 26px;"> Some Text</span> 
 

 
</td> 
 

 
</tr> 
 

 
</tbody> 
 
</table> 
 

 
</td> 
 

 
</tr> 
 

 
</tbody> 
 
</table> 
 

 
</td>

+0

サードパーティのライブラリを使用することはできません。私はHTML、CSS(インライン)のみを持つことができます。 –

+0

私はこのコードテーブルで他のバックグラウンドのテキストを持っていますtr td table tr td .wrap_textbox {display:none;} –

+0

私はHTML電子メールを作っているので、サードパーティライブラリを使用することはできません –

0

顔をしているあなたの質問はかなりあります混乱しますが、なぜを使用して上のようにテキストを配置してください:

<table width="600" align="center"> 
 
     <tr style="background-color: #f1f1f1;"> 
 
      <th style="font-weight: lighter; font-size: 26px;"> 
 
       Some Text 
 
      </th> 
 
     </tr> 
 
     <tr> 
 
      <td valign="top" align="center" style=" opacity: 0.5; background: #fa4b00 no-repeat;"> 
 
       <table width="600" border="0" align="center"> 
 
        <tr> 
 
         <td> 
 
          more text 
 
         </td> 
 
        </tr> 
 
       </table> 
 
      </td> 
 
     </tr> 
 
    </table>

あなたは、あなたはそれが表示されるようにする方法をCSSで<th>スタイルを調整することができます。

関連する問題