Css内容复习随笔

  • Em 基于父元素的字体大小

: :: 单冒号 双冒号区别 低版本浏览器支持: 高版本都支持默认将:变为::, h5规范为::

/*
    参数1:x轴的偏移
    参数2:y轴的偏移
    参数3:阴影的模糊的
    参数4:阴影的延伸
    参数5:阴影的颜色
    参数6:内阴影
    */
    box-shadow: 0 -2px 2px #d8d8d8 inset;
  • 特殊样式
image.png
.product_box.active::before{
    content: "\e915";
    position: absolute;
    left: 0;
    top: -7px;
    font-family: wjs;
    font-size: 33px;
} 
.product_box .pro_right::before,
.product_box .pro_right::after{
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 6px;
    background: #f5f5f5;
    left: -6px;
}
.product_box .pro_right::before{
    top: -6px;
    /*
    参数1:x轴的偏移
    参数2:y轴的偏移
    参数3:阴影的模糊的
    参数4:阴影的延伸
    参数5:阴影的颜色
    参数6:内阴影
    */
    box-shadow: 0 -2px 2px #d8d8d8 inset;
}
.product_box .pro_right::after{
    bottom: -6px;
    box-shadow: 0 2px 2px #d8d8d8 inset;
}



  • 选择器

找到P元素,通过P找到父元素,通过父元素找子元素当中类型为P的,然再去找第几个。
p:first-of-type
p:last-of-type
p:nth-of-type(n)
p:nth-last-of-type(n)
如果使用的是child;
p:first-child
找到P元素,通过P找到父元素,通过父元素找所有的子元素,找第一个元素,匹配判断类型(如果不是无效选择器)

  • 加入元素不影响其他区块?


    image.png
.product_box .pro_right .tips{
    position: absolute;
    left: 0;
    top: 10px;
    width: 100%;
}
.product_box .pro_right .tips span{
    width: 16px;
    height: 16px;
    text-align: center;
    line-height: 16px;
    border-width: 1px;
    border-style: solid;
    display: inline-block;
}
.product_box .pro_right .tips .red{
    color: red;
    border-color: red;
}
.product_box .pro_right .tips .green{
    color: green;
    border-color: green;
}
.product_box .pro_right p:first-of-type{
    margin-top: 25px;
    color: #e92322;
}
.product_box.active .pro_right p:first-of-type{
    color: #fff;
}
.product_box .pro_right p:first-of-type b{
    font-size: 48px;
}
.product_box .pro_right p:first-of-type sub{
    bottom: 0;
    font-size: 12px;
}
.product_box .pro_right p:last-child{}

  • ul默认会有编剧 padding 0
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1.class 和 id 的使用场景? 两者都能选取DOM节点并给DOM节点添加样式,但是W3C标准里规定页面中只...
    饥人谷_米弥轮阅读 3,130评论 0 1
  • 本文转载自:众成翻译译者:为之漫笔链接:http://www.zcfy.cc/article/239原文:http...
    极乐君阅读 12,097评论 1 62
  • CSS选择器常见的有几种? 基础选择器 “*” -> 通用元素选择器,匹配页面任何元素。很少使用 “#” -> i...
    饥人谷_吴亚敏阅读 1,924评论 0 0
  • 今天,我把时间投资到哪了?
    bobo1luo阅读 663评论 0 1
  • 作者:东树 幽径颦颜眉锁,翠微腮雪心垂。春云平起雨来时,落红飞万点,空翠湿千枝。 前忆鸿鹄初见,蒹葭苍莽冰围。念...
    随意诗社阅读 3,707评论 2 8