css制作定位图标

2025-10-23 13:10:23

1、打开html开发软件,在html开发工具中新建一个html代码页面。

css制作定位图标

2、新建一个<div>标签,然后给这个<div>添加一个class类为icon-map。

css制作定位图标

3、制作底部为尖角的圆。创建<style>标签,然后在该标签里面设置icon-map类样式底部为尖角的圆。

css代码:

.icon-map{

color:#333;

width:30px;height:30px;

margin:30px auto;

border:solid 2px currentColor;

border-radius:16px 16px 16px 0;

-webkit-transform:rotate(-45deg);

-moz-transform: ratate(-45deg);

transform:rotate(-45deg);

}

css制作定位图标

4、保存html代码,然后使用浏览器打开,即可在浏览器上看到底部为尖角的圆。

css制作定位图标

5、回到html代码页面,使用after伪类对icon-map设置一个小圆,然后使用postion把小圆放到尖角圆居中的位置。

css代码:

.icon-map:after{

content: "";

width: 8px;

height: 8px;

border:2px solid currentcolor;

position: absolute;

top:9px;

left:9px;

border-radius: 100%;

}

css制作定位图标

6、保存html代码,然后使用浏览器打开,就可以看到浏览器页面上显示一个地图定位的小图标。

css制作定位图标

7、页面所有代码。可以直接复制所有代码,粘贴到新建html页面保存后使用浏览器打开即可看到效果。

所有代码:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>地图定位图标 </title>

<style>

.icon-map{

color:#333;

width:30px;height:30px;

margin:30px auto;

border:solid 2px currentColor;

border-radius:16px 16px 16px 0;

-webkit-transform:rotate(-45deg);

-moz-transform: ratate(-45deg);

transform:rotate(-45deg);

}

.icon-map:after{

content: "";

width: 8px;

height: 8px;

border:2px solid currentcolor;

position: absolute;

top:9px;

left:9px;

border-radius: 100%;

}

</style>

</head>

<body>

<div class="icon-map"></div>

</body>

</html>

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢