Leave td with transparent background

Asked

Viewed 20,997 times

0

How do I make a bgcolor transparent without using STYLE?

I can only use bgcolor on the part, to make no mistakes!! many browsers do not render the style.

Being email marketing I can not use stylesheet, I have to apply all the inline css, know some way to insert the effect of transparency inline?

 <tr>
            <td width="246" height="200" align="center">
               <a href="#" target="_blank">
               <img src="images\foto.jpg" width="200" height="200" border="0" /></a>
            </td>
 </tr>
  • I just hope it’s not for sending SPAM :P

  • hum...how not? inline styles are even used in Mailchimp templates.

3 answers

1


Apply background-color to a style attribute:

<td style="background-color: rgba(123, 123, 123, 0.5)">

The value 0.5 is the amount of transparency you want to put into the color. It varies between 0 (totally transparent) and 1 (without transparency). The other values are the amount of R (red), G (green) and B (blue), which vary between 0 and 255.

I did a test using the attribute bgcolor, but apparently it only works with the function rgb() (does not work with the rgba()).

HTML code:

<div style="background-color: blue">
    <table style="background-color: rgba(123,123,123,0.7)">
        <tr>
            <td>asdasda</td>
        </tr>
    </table>

    adasdasd
</div>

Example in jsFiddle: http://jsfiddle.net/4V5Sz/

  • I can’t use style, I have to use pure html code, in case to change the background would be with bgcolor, if I use style some browsers do not render, causing errors in the part.

  • 1

    As I commented in the reply, rgba did not work with bgcolor. The solution I propose, then, is to do something with a transparent gif.

1

If I understand the question correctly, you can use background-color:rgba();, example:

<table style="background:#666;">
<thead>
    <tr>
        <th>Coluna 1</th>
        <th>Coluna 2</th>
        <th>Coluna 3</th>
    </tr>
</thead>
<tbody>
    <tr style="background:blue;">
        <td>dado</td>
        <td style="background-color:rgba(102,102,102,1);">dado</td>
        <td>dado</td>
    </tr>
    <tr>
        <td>dado</td>
        <td>dado</td>
        <td>dado</td>
    </tr>
    <tr>
        <td>dado</td>
        <td>dado</td>
        <td>dado</td>
    </tr>
</tbody>

See online example: Jsfiddle

  • I can’t use style, I have to use pure html code, in case to change the background would be with bgcolor, if I use style some browsers do not render, causing errors in the part.

0

opacity:0.4;filter:alpha(opacity=40);

<table style="background-image:url('images_teste/1.jpg');opacity:0.4;filter:alpha(opacity=40);">
      <tr>
        <td>2</td>
        <td>&nbsp;</td>
      </tr>
    </table>

For IE8 I tagged filter:alpha(opacity=40); Basically the CSS inline and external code is the same, you put everything on the line, separating by ; "semicolon"

source: http://www.w3schools.com/css/css_image_transparency.asp

  • I can’t use style, I have to use pure html code, in case to change the background would be with bgcolor, if I use style some browsers do not render, causing errors in the part.

  • so unfortunately there is no way. html does not make transparency natively. even Html5, because it is not the focus of html but CSS to make these adjustments.

  • Ever tried to leave a png with alpha channel, transparent and call it ?

  • Friend, I already managed to implement once transparency in TD using html, then I apply an image . gif with half white image and the other half transparent and use TR bgcolor to leave with rounded corners. Understand the intention? I just don’t remember how I did it, but I know I did!! But Thank you for the prompt response to instance!!

  • .PNG tb cannot be used for proper workmanship of the part, outlook among other emails do not render png right and apply background to image when transparent, a bag, but fact!! I’m trying to remember how I did it, but so far nothing..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.