css 手写返回箭头

因为在开发App时,为了自定义返回栏,返回箭头,一般都用图片,当图片不方便,最好用css样式实现。

逻辑:

画出一个正方形,让它旋转45度,只显示你需要的两个边即可

代码

html 复制代码
<!DOCTYPE html>
<html lang="en">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport"
        content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <meta name="apple-mobile-web-app-capable" content="no">
    <title>Css arrow</title>
</head>
<style type="text/css">
    #triangle-facing-right {
        display: inline-block;
        margin: 72px;
        border-right: 24px solid;
        border-bottom: 24px solid;
        width: 120px;
        height: 120px;
        transform: rotate(-45deg);
    }

    #triangle-facing-left {
        display: inline-block;
        margin: 72px;
        border-left: 24px solid;
        border-bottom: 24px solid;
        width: 120px;
        height: 120px;
        transform: rotate(45deg);
    }
</style>

<body>
    <div id="triangle-facing-right"></div>
    <div id="triangle-facing-left"></div>
</body>



</html>
相关推荐
sugar__salt4 小时前
三列布局与 TypeScript 工具类型 Pick / Omit / Partial 详解
前端·javascript·typescript
IMPYLH4 小时前
HTML 的 <html> 元素
前端·javascript·html
IT_陈寒4 小时前
SpringBoot自动配置的坑,把我整不会了
前端·人工智能·后端
赵大仁4 小时前
Human-in-the-loop:前端确认流与后端幂等
前端·后端·ai·agent·人机协作
恋猫de小郭4 小时前
超好用 R8 Configuration Analyzer, 优化你的 App 大小和内存
android·前端·flutter
赖龙13 小时前
pnpm vs npm
前端·npm·node.js
学如逆水,不进则退14 小时前
在线免费音频剪辑:NBTools 可视化波形裁剪 MP3/WAV,本地处理免上传
前端·音视频
Mh14 小时前
虚拟滚动真的比普通滚动性能更好吗?
前端·javascript·性能优化
pe7er14 小时前
React + Ant Design 中的 IME (输入法合成)安全输入组件
前端
Super 含15 小时前
Android 启动优化(二):TTID、TTFD 与 Macrobenchmark 启动性能测量
前端