表示されているデバイスに応じて、ヘッダー画像をシームレスに切り替え/置換できるように取り組んでいます。
以前は、max-width、min-width などを使用してサイズを変更するコードを使用していました...
モバイル (最大 400px) またはデスクトップ (最小 480) に応じて、2 つの画像間で交換したい
デスクトップ ヘッダー: ...phl-headline2.jpg
モバイル ヘッダー (交換予定): ...phl-headline-320-2.jpg
ここに私が取り組んでいるコードがあります...
私が持っているものが現在機能していない理由について、誰かが何らかの洞察や答えを持っていることを願っています。
ありがとうございました!
初投稿
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>PLANET HOME LENDING</title>
<style>
@media only screen and (min-device-width: 480px) and (max-device-width: 1024px)
{
span[id=switcher] {display:block;
background-image: url(http://www.johnroebas.com/hosted/phl-headline2.jpg) !important;
background-repeat: no-repeat !important;
background-position: center !important;
width: 590px !important;
height: 195px !important; }
img[id=houdini] {display: none !important; }
}
@media only screen and (max-device-width: 400px)
{
span[id=switcher] {display:block;
background-image: url(http://www.johnroebas.com/hosted/phl-headline-320-2.jpg) !important;
background-repeat: no-repeat !important;
background-position: center !important;
width: 320px !important;
height: 203px !important; }
img[id=houdini] {display: none !important; }
}
</style>
</head>
<body>
<table border="0" align="center" cellpadding="0" cellspacing="0" style="width: 100%; max-width: 590px; min-width: 320px">
<tbody>
<tr>
<td><table border="0" align="center" cellpadding="0" cellspacing="0" style="width: 100%; max-width: 590px; min-width: 320px">
<tbody>
<tr>
<td height="30" bgcolor="#72c045" style="color:#FFFFFF; font-weight:normal; font-size:10px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:8px;">Now you can lower your monthly mortgage payment</td>
</tr>
<tr>
<td height="62"><img src="http://www.johnroebas.com/hosted/phl-logo-320.jpg" alt="Planet Home Lending" style="display:block; width: 100%; max-width: 247px; max-height: 62px; min-width: 300px; -ms-interpolation-mode: bicubic;"></td>
</tr>
<tr>
<td id="switcher"><img id="houdini" src="http://www.johnroebas.com/hosted/phl-headline2.jpg" alt="Good News" style="display:block; -ms-interpolation-mode: bicubic;"></td>
</tr>
<tr>
<td><table width="390" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td height="18" colspan="2"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="18" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td height="36" colspan="2" style="color:#0f1752; font-weight:normal; font-size:12px; line-height:18px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:8px; padding-right:8px;">
<strong>[FIRST NAME],<br>
Good news from Planet Home Lending:</strong></td>
</tr>
<tr>
<td height="16" colspan="2"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="16" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td width="28" style="vertical-align:top"><img src="http://www.johnroebas.com/hosted/phl-button.jpg" width="28" height="28" style="display:block;"></td>
<td width="362" style="color:#0f1752; vertical-align:bottom; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:8px; padding-right:8px;">
We reviewed your account – you may be eligible<br>
for a simplified refinance to a lower rate:</td>
</tr>
<tr>
<td height="10" colspan="2"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="10" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td colspan="2"><table width="286" border="1" bordercolor="#72c045" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td bgcolor="#72c045" style="color:#FFFFFF; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:4px; padding-right:8px;">Your rate after refinancing:</td>
</tr>
<tr>
<td style="color:#0f1752; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:4px; padding-right:8px; padding-bottom:4px; padding-top:2px;"><strong>X.XX%</strong><br>
(X.XX% Interest Rate)</td>
</tr>
<tr>
<td bgcolor="#72c045" style="color:#FFFFFF; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:4px; padding-right:8px;">New lower monthly payment:</td>
</tr>
<tr>
<td style="color:#0f1752; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:4px; padding-right:8px; padding-bottom:4px; padding-top:2px;"><strong>$X,XXX.XX</strong></td>
</tr>
<tr>
<td bgcolor="#72c045" style="color:#FFFFFF; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:4px; padding-right:8px;">Your possible savings:</td>
</tr>
<tr>
<td style="color:#0f1752; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:4px; padding-right:8px; padding-bottom:4px; padding-top:2px;"><strong>$XXX</strong> per month</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="10" colspan="2"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="10" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td width="28" style="vertical-align:top"><img src="http://www.johnroebas.com/hosted/phl-button.jpg" width="28" height="28" align="abstop" style="display:block;"></td>
<td width="362" style="color:#0f1752; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:8px; padding-right:8px;">
30-year fixed rate, loan amount up to $XXX,XXX</td>
</tr>
<tr>
<td height="10" colspan="2"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="10" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td width="28" style="vertical-align:top"><img src="http://www.johnroebas.com/hosted/phl-button.jpg" width="28" height="28" align="abstop" style="display:block;"></td>
<td width="362" style="color:#0f1752; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:8px; padding-right:8px;">
$0 out-of-pocket closing cost option</td>
</tr>
<tr>
<td height="10" colspan="2"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="10" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td width="28" style="vertical-align:top"><img src="http://www.johnroebas.com/hosted/phl-button.jpg" width="28" height="28" align="abstop" style="display:block;"></td>
<td width="362" style="color:#0f1752; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:8px; padding-right:8px;">
No home appraisal needed</td>
</tr>
<tr>
<td height="10" colspan="2"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="10" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td width="28" style="vertical-align:top"><img src="http://www.johnroebas.com/hosted/phl-button.jpg" width="28" height="28" style="display:block;"></td>
<td width="362" style="color:#0f1752; vertical-align:bottom; font-weight:normal; font-size:12px; line-height:16px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:8px; padding-right:8px;">
No “mortgage mumbo jumbo”– that’s the Planet Home Lending promise!</td>
</tr>
</tbody>
</table></td>
</tr>
<tr>
<td height="18"><img src="http://www.johnroebas.com/hosted/phl-spacer.jpg" width="40" height="18" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td><img src="http://www.johnroebas.com/hosted/phl_phone.jpg" alt="Call" align="absbottom" style="display:block; width: 100%; max-width: 590px; max-height: 64px; min-width: 300px; -ms-interpolation-mode: bicubic;"></td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">
THIS OFFER IS NOT BEING MADE BY AN AGENCY OF THE US GOVERNMENT. PLANET HOME LENDING IS NOT AFFILIATED WITH ANY GOVERNMENT ENTITY.
</td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">
THE PRODUCTS AND SERVICES DESCRIBED HEREIN HAVE NOT BEEN APPROVED OR ENDORSED BY ANY GOVERNMENTAL AGENCY.</td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">
Monthly payment is based on your current unpaid principal balance of $XXX,XXX.XX. Terms are based on a 30-year Fixed Rate Loan. Actual terms may vary based on loan product. Advertised monthly payment reflects principal and interest payments only and does not include insurance and tax premiums. </td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">
Total monthly payments will be higher. Other terms and restrictions may apply. Please call for details.</td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">
Monthly possible savings amount is based on the difference between your current principal and interest payment and the proposed principal and interest payment as shown in this letter. Monthly payments do not include insurance and tax premiums and, therefore, your monthly savings may be less. Please call for details.</td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">
You must be at least 18 years of age to apply. You may be required to meet eligibility criteria including (but not limited to), the following: that your loan be secured by your primary residence; that you meet minimum credit score benchmark, credit history and mortgage payment history requirements; that you are currently employed; and that your combined monthly debts and other credit obligations are not excessive in relation to your verifiable gross monthly income.</td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">
Equal Housing Lender. Planet Home Lending, LLC NMLS ID # 17022</td>
</tr>
<tr>
<td height="8" bgcolor="#e4f3dc"><img src="http://www.johnroebas.com/hosted/phl-spacer2.jpg" width="40" height="8" style="display:block;" align="absbottom"></td>
</tr>
<tr>
<td bgcolor="#e4f3dc" style="color:#000000; font-weight:normal; font-size:8px; line-height:12px; font-family: verdana, open sans, helvetica, gill sans, sans-serif; padding-left:14px; padding-right:14px;">(www.nmlsconsumeraccess.org). Headquarters located at 321 Research Parkway, Suite 303, Meriden, CT 06450. AZ Mortgage Banker License MB-0929069, Licensed by the Department of Business Oversight under the California Residential Mortgage Lending license #: 4130947, Georgia Residential Mortgage Licensee #24035, Illinois Residential Mortgage Licensee, Licensed by the Mississippi Department of Banking and Consumer Finance, Licensed by the New Hampshire Banking Department, OH Mortgage Broker Act Mortgage Banker Exemption MBMB.850161.000, OR Mortgage Lending License ML-5147, Rhode Island Licensed Lender, Licensed by the N.J. Department of Banking and Insurance, TX SML Mortgage Banker, WA Consumer Loan Company License CL-17022</td>
</tr>
<tr>
<td bgcolor="#e4f3dc"> </td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
</body>
</html>