当前位置: 首页 > news >正文

用CSS创造三角形案例

6.3.2 用CSS创造三角形

用div来创建,角上是平分的,所以要是内部宽高为0,其他边透明,正好是三角形。

代码

div {border: 12px solid;width: 0;height: 0;border-color: transparent red transparent transparent;
}

与伪元素after结合起来,在6.3.弹出层.html中增加CSS:

<!DOCTYPE html>
<html><head><meta charset="utf-8"><title></title><style>figure {width: 144px;height: 153px;margin: 20px 20px;border: 1px solid #666;position: relative;float: left;}img {width: 144px;height: 153px;display: block;}figcaption {display: none;/* 隐藏弹出层 */position: absolute;/* 相对于容器 */left: 74%;/* 放到右边 */top: 15px;width: 130px;/* 弹出层宽度 */padding: 10px;/* 弹出层内边距 */background-color: #f2eaea;border: 3px solid red;border-radius: 6px;}/* 鼠标悬停在图片上显示 */figure:hover figcaption {display: block;}figcaption h3 {/*弹出层的内容*/font-size: 14px;color: #666;margin-bottom: 6px;}figcaption a {/*弹出层的内容*/display: block;text-decoration: none;font-size: 12px;color: #000;}/* 把弹出层设置为最高层 */figure:hover figcaption {display: block;z-index: 2;}/* 红色三角形盒子 */figcaption::after {content: "";position: absolute;border: 12px solid;border-color: transparent red transparent transparent;height: 0px;width: 0px;top: 17px;right: 100%;}</style>
</head><body><figure><img src="img/pink.jpg" alt="pink heels" /><figcaption><h3>Pink Platforms</h3><a href="#">More info</a></figcaption></figure><figure class="click_me"><img src="img/baowen.jpg" alt="baowen heels" /><figcaption><h3>Leopard Platforms</h3><a href="#">More info</a></figcaption></figure><figure class="click_me"><img src="img/red.jpg" alt="red heels" /><figcaption><h3>Red Platforms</h3><a href="#">More info</a></figcaption></figure>
</body></html>

http://www.lryc.cn/news/451475.html

相关文章:

  • matlab-对比两张图片的Ycbcr分量的差值并形成直方图
  • Chromium 使用安全 DNS功能源码分析c++
  • 10.1 刷题
  • 车辆重识别(2021ICML改进的去噪扩散概率模型)论文阅读2024/9/29
  • 828华为云征文|针对Flexus X实例云服务器的CPU和内存性能测评
  • Python知识点:如何使用Google Cloud IoT与Python进行边缘计算
  • 力扣 最小覆盖子串
  • python的内存管理机制
  • 阿布量化:基于 Python 的量化交易框架
  • 计算机前沿技术-人工智能算法-大语言模型-最新研究进展-2024-09-28
  • 【tower-boot 系列】开源RocketMQ和阿里云rockerMq 4.x和5.x集成 (一)
  • Pikachu-Cross-Site Scripting-反射型xss(post)
  • Vue3 工具函数(总结)
  • (undone) MIT6.824 Lab1
  • SpringMVC——REST
  • 【牛客网刷题记录】【java】二叉树
  • 一文讲透大语言模型构建流程
  • VR视频怎样进行加密和一机一码的使用?--加密(一)
  • Ubuntu启动后第一次需要很久才能启动GTK应用问题
  • 栏目二:Echart绘制动态折线图+柱状图
  • Gromacs——使用过程中暴露问题分析及学习
  • Webpack模式-Resolve-本地服务器
  • 【LLM论文日更】| 通过指令调整进行零样本稠密检索的无监督文本表示学习
  • 02.01、移除重复节点
  • 旅游推荐|旅游推荐系统|基于Springboot+VUE的旅游推荐系统设计与实现(源码+数据库+文档)
  • github项目--crawl4ai
  • 仅有N卡独显的情况下安装ubuntu是遇到的黑屏,加载卡顿等问题
  • Vite:为什么选 Vite
  • 个人项目简单https服务配置
  • Rust 函数