CMS Development

Ghost
参加者

How would I add a dark overlay to a background image?

解決

How would I add a dark overlay to a background image?

 

Here's the code I'm using:

 

<table cellpadding="0" cellspacing="0" border="0" style="min-width: 100%; width: 100%;">
<tr>
<td background="{{ widget.background_image.src }}" style="background-size: cover; background-image: url('{{ widget.background_image.src }}');" bgcolor="{{ heroBackgroundColor }}" valign="top">

<!--[if gte mso 9]>
<v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width: 600px;">
<v:fill type="tile" src="{{ widget.background_image.src }}" color="#eeeeee" />
<v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0">
<![endif]-->

<div>
<table width="400" style="min-width: 100%; width: 100%;">
<tr>
<td colspan="3" height="10"></td>
</tr>
<tr>
<td width="{{ widget.logo.width }}" style="padding-left: 15px;">
{% if widget.logo.src %}
<img src="{{ widget.logo.src }}" width="{{ widget.logo.width }}" height="{{ widget.logo.height }}" alt="{{ widget.logo.alt }}">
{% endif %}
</td>

<tr>
<td colspan="3" height="50">&nbsp;</td>
</tr>
<tr>
<td colspan="3" valign="middle" align="center" style="font-family: Helvetica, Arial, Verdana, Trebuchet MS, sans-serif; font-weight: 900; font-size: 30px; color: #ffffff;">{{ widget.heading }}</td>
</tr>
<tr>
<td colspan="3" height="15" style="font-size: 0px;"></td>
</tr>
<tr>
<td colspan="3" valign="middle" align="center" style="font-family: Helvetica, Arial, Verdana, Trebuchet MS, sans-serif; text-align: center; font-weight: 900; font-size: 14px; color: #ffffff;">{{ widget.subheading }}</td>
</tr>
<tr>
<td colspan="3" height="20" style="font-size: 0px;"></td>
</tr>
<tr>
<td colspan="3" valign="middle" align="center" style="text-align: center; font-size: 14px; color: #ffffff;">{{ widget.cta }}</td>
</tr>
<tr>
<td colspan="3" height="50">&nbsp;</td>
</tr>
</table>
</div>
<!--[if gte mso 9]>
<p style="margin:0;mso-hide:all"><o:p xmlns:o="urn:schemas-microsoft-com:office:office">&nbsp;</o:p></p>
</v:textbox>
</v:rect>

<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>

<![endif]-->
</td>
</tr>
</table>

0 いいね!
1件の承認済みベストアンサー
JanetArmstrong
解決策
トップ投稿者 | Solutions Partner
トップ投稿者 | Solutions Partner

How would I add a dark overlay to a background image?

解決
box-shadow: inset 0 0 0 300px rgba(0,0,0,.5);


You can add something like that to the background-image. Adjust the .5 for lighter or darker and 300px can be bigger if it doesn't fill the area.

元の投稿で解決策を見る

0 いいね!
5件の返信
dennisedson
HubSpot製品開発チーム
HubSpot製品開発チーム

How would I add a dark overlay to a background image?

解決

maybe not the answer you want, but use an image that has the overlay applied in photoshop or your image editor of choice. 

Already pushing the limits with a background image in email. 

a solution may be here

 

godspeed

0 いいね!
JanetArmstrong
解決策
トップ投稿者 | Solutions Partner
トップ投稿者 | Solutions Partner

How would I add a dark overlay to a background image?

解決
box-shadow: inset 0 0 0 300px rgba(0,0,0,.5);


You can add something like that to the background-image. Adjust the .5 for lighter or darker and 300px can be bigger if it doesn't fill the area.

0 いいね!
Ghost
参加者

How would I add a dark overlay to a background image?

解決

Thank you!! This worked!

0 いいね!
dennisedson
HubSpot製品開発チーム
HubSpot製品開発チーム

How would I add a dark overlay to a background image?

解決

Just understand that rgba is not going to work everywhere .

0 いいね!
jennysowyrda
コミュニティーマネージャー
コミュニティーマネージャー

How would I add a dark overlay to a background image?

解決

Hey @Ghost,

 

Do you have a link to the page you're working on? The more information, details and screenshots you can provide the better the Community can assist!

 

Thanks,
Jenny

0 いいね!