【发布时间】:2014-09-17 08:47:15
【问题描述】:
我正在使用一个电子邮件模板,并且我正在尝试使用一个复选框在选中该框时显示附加信息(适用于 Android Gmail 客户端)。我目前有一个工作设置,它使用一个带焦点的按钮将内容的显示更改为内联。一旦用户单击按钮上的焦点,附加信息将返回显示:无。
按钮配置示例代码
button.showDetails:focus + .moreInfo {display:inline!important;} //Toggles content on when focused to display moreInfo.
<button type="button" class ="showDetails" style ="//display:none; /* background:whitesmoke; outline:none; border:none; width:0px; height:0px;*/">Leasing Terms</button> <!!--Hide Button for GMAIL by styling CSS. Reveal in others with body CSS.-->
<table class ="moreInfo" width="240px" cellspacing="0" cellpadding="0" border="0" style ="display:none;">
<tr>
<td width="50%" align="center" style="font-size:.7em;">$269 a month lease for 36 months. 12,000 miles per year. $2,000 due at signing and no security deposit required. On approved credit. An extra charge may be imposed at the end of the lease term due to mileage overage. Price plus tax, title, and license.</td>
</tr>
</table>
根据活动监视器https://www.campaignmonitor.com/css/,Android GMAIL 不支持 :focus 伪选择器。作为 android GMAIL 的解决方法,我正在尝试使用复选框并使用属性选择器和通用兄弟选择器的组合。是否可以使用属性选择器来设置复选框的样式,或者在这种情况下,如果复选框被选中,则为该复选框的兄弟设置样式?
这里是复选框的示例。
<style>
input.showDetails[checked = "checked"] ~ .moreInfo {-webkit-display:inline!important;}
</style>
<input class= "showDetails" type="checkbox" >Disclaimer
<button type="button" class ="showDetails" style =" width:100%;display:none; /* background:whitesmoke; outline:none; border:none; width:0px; height:0px;*/">New Vehicles Disclaimer</button> <!!--Hide Button for GMAIL by styling CSS. Reveal in others with body CSS.-->
<p class="moreInfo" style="display:none">All prices plus tax, title, license, and doc fee. See dealer for details</p>
当我将样式标签放在正文标签的底部时,我确实让属性选择器和同级选择器工作,但只有在复选框的默认设置为选中时。无论如何,一旦用户检查了复选框,就使用 css 设置复选框的样式?还有其他可能有类似效果的方法吗?
谢谢
附: javascript和jquery不能用。
【问题讨论】:
-
你能给你的复选框添加任何值吗?
-
你试过
:checked伪吗?
标签: css html-email android-checkbox