All Projects → hangyangws → Basecss

hangyangws / Basecss

Licence: mit
CSS基类,减少浏览器差异,常用CSS类名

Labels

Projects that are alternatives of or similar to Basecss

H5ui
Lightweight, elegant open source mobile UI style library.
Stars: ✭ 44 (-36.23%)
Mutual labels:  css3
Sharebook Frontend
Projeto frontend de código livre para o app Sharebook.
Stars: ✭ 59 (-14.49%)
Mutual labels:  css3
Magz
Free Resonsive HTML5 & CSS3 Magazine Template
Stars: ✭ 64 (-7.25%)
Mutual labels:  css3
Awesome Flexbox
👓 A curated list of CSS Flexible Box Layout Module or only Flexbox.
Stars: ✭ 1,034 (+1398.55%)
Mutual labels:  css3
Root Bootstrap 4 Admin Template With Angularjs Angular 2 Support
Root is Boostrap 4 Admin Template with Angular 2 and AngularJS support
Stars: ✭ 54 (-21.74%)
Mutual labels:  css3
Morphist
A simple, high-performance and cross-browser jQuery slider / slideshow / carousel plugin for child objects powered by Animate.css.
Stars: ✭ 60 (-13.04%)
Mutual labels:  css3
Sort Visualizer
This is a web app built to visualize classic sorting algorithms such as insertion sort, merge sort, quick sort, heap sort, etc. The entire app is built with only React; no other third-party JS or CSS library has been used.
Stars: ✭ 41 (-40.58%)
Mutual labels:  css3
Orientationchange Fix
基于@media特性实现对原生orientationchange的修复 ( orientationchange-fix is a based on @media attribute to fix orientationchange utility library, orientaionchange polyfill.)
Stars: ✭ 68 (-1.45%)
Mutual labels:  css3
Box Shadows
Box Shadows - Handpicked Box-Shadows for Developers and Designers
Stars: ✭ 58 (-15.94%)
Mutual labels:  css3
Dev Practice
Practice your skills with these ideas.
Stars: ✭ 1,127 (+1533.33%)
Mutual labels:  css3
Frontend Mentor Challenge
Here you will find all the challenges that we took from frontend-mentor.
Stars: ✭ 47 (-31.88%)
Mutual labels:  css3
Samsara
☸️ Continuous UI
Stars: ✭ 1,051 (+1423.19%)
Mutual labels:  css3
Web Code Standards
通过分析 Github 众多前端代码库,总结出来的前端代码书写规范。
Stars: ✭ 61 (-11.59%)
Mutual labels:  css3
Nodejs Socketio Chat App
MEAN Stack & Socket.IO Real-time Chat App | A MEAN stack based Real Time chat application
Stars: ✭ 45 (-34.78%)
Mutual labels:  css3
Blog
📚 专注Web与算法
Stars: ✭ 1,140 (+1552.17%)
Mutual labels:  css3
Nly Adminlte Vue
vuejs2 AdminLte3 template more than 50 components and 10 directives.such as collapse ,sidebar,container,infobox,breadcrumb,card,grid,dropdown,toast,navbar,timeline,icon,progress
Stars: ✭ 44 (-36.23%)
Mutual labels:  css3
Vue Mobile Mint
🍔 🍖 🍴基于mint-ui的饿了么外卖平台混合app(仿饿了么)
Stars: ✭ 59 (-14.49%)
Mutual labels:  css3
Record
✨✨都是自己输出和看过觉得不错的文章,欢迎star、watch!!同时欢迎推荐新文章、书籍和视频!!
Stars: ✭ 69 (+0%)
Mutual labels:  css3
Redpacketrain
红包雨
Stars: ✭ 68 (-1.45%)
Mutual labels:  css3
Pure Css3 Animated Border
Pure CSS3 animated border for all html element.
Stars: ✭ 63 (-8.7%)
Mutual labels:  css3

baseCss

意义

统一不同浏览器差异、团队开发起始标准;弥补浏览器的「缺点」

友情提示

前端开发中如果不是 UI 特别要求,颜色值采用 web 安全色最佳,像素以偶数最佳
移动端开发,量度可以尝试 rem 为单位「什么是 rem,请自行 Google」
使用 rem 为量度单位时,浏览器会是基于 html 节点而不是 body 节点计算大小

代码解释

/**
 * base.css - 航洋无声
 * mail -  [email protected]
 * weibo - http://weibo.com/512jj
 */

html {
  /*标准字体大小设置 14 像素「rem 参照对象」*/
  font-size: 14px;
  /*滚动事件发生在 html 元素上;JS 中可以监听 html 的滚动*/
  overflow-y: auto;
  /*让 html 和浏览器窗口高度一致*/
  height: 100%;
  /*少数浏览器默认背景色为浅灰色,所以设置默认背景颜色为纯白*/
  background-color: #fff;
}

html,
body {
  /*body 宽度大 html 度时,某些浏览器会出现内部滚动条;所以设置「html、body」宽度相同且「overflow-x: hidden」*/
  overflow-x: hidden;
  width: 100%;
  /*取消部分浏览器点击有阴影*/
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  /*优化移动端滚动事件*/
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
}

body {
  /*设置基本字体配置*/
  font: 1rem 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Yahei', Arial, sans-serif;
  /*让绝对定位元素,根据 body 定位*/
  position: relative;
  /*设置网页基本字体颜色为浅灰色*/
  color: #666;
  /*使字体渲染更顺滑*/
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}


/**
 * 移除常用标签的浏览器默认的「margin、padding」
 * pre、code、legend、fieldset、blockquote … 等标签不是很常用,所以就不一一列举,如果项目中使用到,可以自己单独写
 */

body,
p,
h1,
h2,
h3,
h4,
h5,
h6,
dl,
dd,
ul,
ol,
th,
td,
button,
figure,
input,
textarea,
form {
  margin: 0;
  padding: 0;
}


/**
 * 不同浏览器的 input、select、textarea 的盒子模型宽度计算方式不同,统一为最常见的 content-box
 */

input,
select,
textarea {
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
}

table {
  /*table 相邻单元格的边框间的距离设置为 0*/
  border-spacing: 0;
  /*默认情况下给 tr 设置 border 没有效果,如果 table 设置了边框为合并模式:「border-collapse: collapse;」就可以了*/
  border-collapse: collapse;
}


/**
 * 移除浏览器部分元素的默认边框
 * acronym、fieldset … 等其他标签不是很常用,就不会一一列举;如果项目中用到,可以自己单独写
 */

img,
input,
button,
textarea {
  border: none;
  -webkit-appearance: none;
}

input {
  /*由于 input 默认不继承父元素的居中样式,所以设置:「text-align: inherit」*/
  text-align: inherit;
}

textarea {
  /*textarea 默认不可以放缩*/
  resize: none;
}


/**
 * 由于以下元素的部分属性没有继承父节点样式,所以声明这些元素的这些属性为父元素的属性
 * 取消这些元素 `outline` 样式
 */

a,
h1,
h2,
h3,
h4,
h5,
h6,
input,
select,
button,
option,
textarea,
optgroup {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  line-height: inherit;
  color: inherit;
  outline: none;
}


/**
 * 取消超链接元素的默认文字装饰
 * 另外 del、ins 标签的中划线、下划线还是挺好的,就不去掉
 */

a {
  text-decoration: none;
}

ol,
ul {
  /*开发中 UI 设计的列表都是和原生的样式差太多,所以直接给取消 ol,ul 默认列表样式*/
  list-style: none;
}

button,
input[type='submit'],
input[type='button'] {
  /*鼠标经过是「小手」形状表示可点击*/
  cursor: pointer;
}

input::-moz-focus-inner {
  /*取消火狐浏览器部分版本 input 聚焦时默认的「padding、border」*/
  padding: 0;
  border: 0;
}


/*取消部分浏览器数字输入控件的操作按钮*/

input[type='number'] {
  -moz-appearance: textfield;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}


/*输入控件 placeholder 色设置 #999*/

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: #999;
}

input:-moz-placeholder,
textarea:-moz-placeholder {
  color: #999;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
  color: #999;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  color: #999;
}

template {
  /*由于部分浏览 template 会显示出来,所以要隐*/
  display: none;
}

另外附上 常用原子类

感谢阅读

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].