13. 实战总结

2017-07-29  本文已影响0人  Joey的企鹅

1. Hover时位移的一个较好方案

<!DOCTYPE html>
<html>
<head>
<meta name="description" content="hover滑动模型" />
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div class="parent">
    <div class="child">
      <div class="box"></div>
    </div>
  </div>
</body>
</html>
.parent {
  width: 200px;
  height: 400px;
  border: 2px solid;
}
.box {
  margin-top: 200px;
  box-sizing: border-box;
  width: 200px;
  height: 200px;
  background-color: #03a9f4;
  /* border: 1px solid #fff; */
  transition: all .5s;
}
.child {
  border: 1px solid red;
}
.child:hover .box{
  transform: translateY(-200px);
  /* margin-top: 0px; */
}

2.引入字体

推荐网站(英文字体):http://www.googlefonts.cn/#
搜索字体后点击Quick-use,然后勾选需要的类型(粗细正斜等),然后复制link到<head>...</head>中即可。

3. 布局

先纵观页面考虑好各个部分的同与异再进行布局是最好的。
相同的部分用统一的class进行设置。虽然之前学习过程中被强调过这点,但实际独立作业时,才发现这点有多么重要。

4. Hover时透明膜覆盖

先写个rgba背景色,opacity设置成0;
hover时,opacity设置成想要的状态。

5. Form中placeholder内的样式设置

::-webkit-input-placeholder: {
}

6. Font简写

font: style(formal/italic)——variant——weight(数字或bold)——size/line-height——family;

7. 本地添加Iconfont字体文件

下载后,把4个iconfont开头的不同格式文件放到html cssd代码所在的文件夹下,打开iconfont.css,把@声明复制过去。注意,若文件统一放到文件夹中,则要修改声明中的路径。注意路径分隔用/。
本地文件用VScode在Chrome打开后,在线iconfont链接无法使用,必须使用本地连接。

8. Github使用过程中pull不下来的问题

一般是因为没有指定当前当前工作目录工作分支,跟远程的仓库、分支之间的关系。
输入git branch --set-upstream master origin/master(对应origin master)即可。

9. 百分比高度

若一个标签写了百分比高度,那么它的各个父级都需要写上百分比高度。

10.Iconfont的字体图标

Iconfont的字体图标可以自己打开修改、微调,以使得他们在自己的web中显示的相对统一。
经验:像素拉高去放缩和位移,像素调低去观察位置。

11. 重温CSS Sprite

给需要加入sprite的标签都打上统一的class,然后在这个class的css中统一引入background-image``background-repeat: no-repeat;并且记得display: inline-block(便于行并列以及设置宽高),然后分别设置background-position即可,同时别忘了用vertical-align去调整对齐。

12. 手机端显示问题(important

如果通栏布局,手机端显示不全,出现“滚动背景色”,可以给body设置min-width解决。

13. VIM如何删除全部内容

按Esc键切换到命令行模式
:1,$d

14. 取消外边距合并

生成块级格式化上下文。
我比较常用padding-top: 1px或者overflow: hidden,详细方法见之前文章。

上一篇 下一篇

猜你喜欢

热点阅读