需要使用到h5的 <a>标签

我们首先在<head>标签中添加代码

    <meta name="format-detection" content="telephone=yes"/>

然后再想要的位置添加代码

 <a href="tel:10086"> 点击拨打:10086 </a>

这样功能就实现了,完整代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>打电话</title>
<meta name="format-detection" content="telephone=yes"/>
</head>
<body>

 <a href="tel:10086"> 点击拨打:10086 </a>

</body>
</html>

这样最重的样式是这样的

如果你不想要这个下划线,可以在样式中修改,给<a>标签添加一个class属性,如:

 <a href="tel:10086" class="phone_point"> 点击拨打:10086 </a>

然后再style中添加样式:

.phone_point{
  text-decoration: none;
}

这样就可以了,完整代码如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>打电话</title>
<meta name="format-detection" content="telephone=yes"/>
</head>
<body>
<a href="tel:10086" class="phone_point"> 点击拨打:10086 </a>

</body>
<style>
.phone_point{
  text-decoration: none;
}
</style>
</html>

最终效果:

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部