品优购项目整理

H5中新增的一些语义化标签

<header>头部标签</header>
<nav>导航标签</nav>
<section>块级标签</section>
<aside>侧边栏标签</aside> 
<footer>尾部标签</footer>

通过伪类为设置图标

/*在公有样式中引入字体*/
@font-face {
    font-family: 'icomoon';
    src:  url('../fonts/icomoon.eot?tomleg');
    src:  url('../fonts/icomoon.eot?tomleg#iefix') format('embedded-opentype'),
      url('../fonts/icomoon.ttf?tomleg') format('truetype'),
      url('../fonts/icomoon.woff?tomleg') format('woff'),
      url('../fonts/icomoon.svg?tomleg#icomoon') format('svg');
    font-weight: normal;
    font-style: normal;
    font-display: block;
  }
 /*通过伪类方式可以为标签指定图标*/
.head-hd a::after {
  font-family: 'icomoon'; 
  content: '\e920';  /*指定图标*/
}

后代选择器的使用

/*注意使用后代选择器时li:nth-child 要紧挨着写
 此处为选择子代中编号为偶数的进行修改样式
*/
.shortcut .fr ul li:nth-child(even){
   width: 1px;
   height: 12px;
   margin: 9px 15px 0;
   background-color: #666;
}

基础知识

  1. 行内元素可以指定margin-left ,margin-right但是不能指定`margin-top,margin-bottom
  2. 行内块元素可以指定宽度和高度
  3. 只有行内块块元素才具有border属性
margin: 10px; /*上,下,左,右外边距为10*/
margin: 10px 20px ;/*上下外边距为10 ;左右外边距为20
*/
margin: 10px 20px 30px ;/*上外边距10;左右外边距 20 ;下外边距 30*/
margin: 10px 20px 30px 40px;/* 上外边距10;右外边距 20 ;下外边距 30; 左边距为40*/

  1. 如果盒子设置为 marign: 40px auto; (即上下外边距任意,左右外边距自动)盒子会水平居中。
  2. margin-top = -2px; 盒子会向上移动2px

对标签a中的文字实现隐藏

a {
    font-size: 0;   /*将文字大小设置为0*/
    /* 淘宝隐藏文字的方式
    text-indent: -9999px;
    overflow: hidden;
     */
  }
   
}

外边距塌陷

超出的文字使用…

.head-bd ul li {
  /*height: 24px;
  line-height: 24px;*/
  /* 超出部分文字 */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

base.css(项目之前引入可用于清除一些属性)

/* 把我们所有标签的内外边距清零 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
/* em 和 i 斜体的文字不倾斜 */
em,
i {
    font-style: normal
}
/* 去掉li 的小圆点 */
li {
    list-style: none
}

img {
    /* border 0 照顾低版本浏览器 如果 图片外面包含了链接会有边框的问题 */
    border: 0;
    /* 取消图片底侧有空白缝隙的问题 */
    vertical-align: middle
}

button {
    /* 当我们鼠标经过button 按钮的时候,鼠标变成小手 */
    cursor: pointer
}

a {
    color: #666;
    text-decoration: none
}

a:hover {
    color: #c81623
}

button,
input {
    /* "\5B8B\4F53" 就是宋体的意思 这样浏览器兼容性比较好 */
    font-family: Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, 
    "\5B8B\4F53", sans-serif;
    /* 去除输入框和按钮的边框 */
    border: 0;
    outline: none;
}

body {
    /* CSS3 抗锯齿形 让文字显示的更加清晰 */
    -webkit-font-smoothing: antialiased;
    background-color: #fff;
    font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
    color: #666
}

.hide,
.none {
    display: none
}
/* 清除浮动 */
.clearfix:after {
    visibility: hidden;
    clear: both;
    display: block;
    content: ".";
    height: 0
}

.clearfix {
    *zoom: 1
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值