繁体   English   中英

将href短信更改为具有响应式设计的href mailto?

[英]Change a href sms to a href mailto with responsive design?

如果设备不支持短信,即未在手机(iPhone,Android等)上查看网页,是否可以将href短信更改为href mailto?

我设法制作了一个“呼喊”按钮,该按钮使用短信发送网页的网址,但是我希望在不通过电话查看时(即在平板电脑上查看网页时)将其更改为mailto,笔记本电脑等

这是我整理的代码:

<section id="shout">
    <button class="button shout"><a href="sms:?&body=mysite.com" class="shoutButton">Shout</a></button>
</section>

我正在使用外部CSS文件来设置页面和按钮的样式。 它似乎可以在我尝试过的所有手机上使用,所以很酷。 我已经研究过使用@media,但这似乎不是正确的方法,并且我尝试了其他方法,但均未成功。 我给了它一个不错的选择,但是我的技能不是很好,因此任何帮助将不胜感激。

谢谢 :)

您将创建两个链接,并且仅基于CSS @media查询显示一个链接。

 /* Default Style (mobile first!) */ .phone { display:inline; } .desktop { display:none; } /* Desktops */ @media screen and (min-width:1024px) { .phone { display:none; } .desktop { display:inline; } } 
 <section id="shout"> <button class="button shout phone"> <a href="sms:?&body=mysite.com" class="shoutButton">Shout from Phone</a> </button> <button class="button shout desktop"> <a href="mailto:something@something.com" class="shoutButton">Shout from Desktop</a> </button> </section> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM