代码记录

https://www.w3school.com.cn/css/css_table.asp

设置行内元素使高度能垂直居中

line-height: 50px;

设置行内元素能水平居中

text-align:center;

高度塌陷与BFC

overflow:hidden;

使用after偽類解決高度塌陷

.box1::after{
    content: '';
    display: block;
    clear: both;
}

使用clearfix解決高度塌陷和父子塊外邊距重疊問題

.clearfix::before,
.clearfix::after{
    content: '';
    display: table;
    clear: both;
}

使用 FontAwesome图标

.location::before {
    content: "\f3c5";
    font-family: "FontAwesome";
    color: red;
}

box的阴影效果

box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);

三角形效果

.appa::after {
    content: '';
    border: 10px solid transparent;
    border-top: none;
    border-bottom-color: white;
    position: relative;
    top: 2px;
    left: -20px
}

hover选择after

.appa::after {
    content: '';
    border: 8px solid transparent;
    border-top: none;
    border-bottom-color: white;
    position: absolute;
    bottom: 0;
    left: 12px;
    display: none;

}

.appa:hover .qrcode,
.appa:hover::after {
    display: block;
}

固定定位的写法

    position: fixed;
    right: 50%;
    margin-right: -643px;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 前端 VScode 自动换行(word wrap) ctrl + s 保存 ctrl + a 全选 ctrl + ...
    东方寂明阅读 4,693评论 0 1
  • 1. box-sizing box-sizing属性主要用来控制元素的盒模型的解析模式。默认值是content-b...
    下下下个路口左转阅读 1,441评论 0 0
  • 1.1CSS 基础与选择器初识 | CSS 1. CSS 加载方式有几种? CSS样式加载一共有四种方式: 1、行...
    没糖_cristalle阅读 4,312评论 0 0
  • 前端开发面试题 面试题目: 根据你的等级和职位的变化,入门级到专家级,广度和深度都会有所增加。 题目类型: 理论知...
    怡宝丶阅读 7,414评论 0 7
  • <a name='html'>HTML</a> Doctype作用?标准模式与兼容模式各有什么区别? (1)、<...
    clark124阅读 9,058评论 1 19

友情链接更多精彩内容