css通用命名大全,CSS的常用命名及规范

常用命名

标题:title

摘要:summary

箭头:arrow

商标:label

网站标志:logo

转角/圆角:corner

横幅广告:banner

子菜单:subMenu

搜索:search

搜索框:searchBox

登录:login

登录条:loginbar

工具条:toolbar

下拉:drop

标签页:tab

当前的:current

列表:list

滚动:scroll

服务:service

提示信息:msg

热点:hot

新闻:news

小技巧:tips

下载:download

加入:joinus

注册:regsiter

指南:guide

友情链接:friendlink

状态:status

版权:copyright

按钮:btn

合作伙伴:partner

投票:vote

左/中/右:left/center/right

简介:profiles

评论:comment

ID命名

(1) 页面结构

容器:container

页头:header

内容:content/container

页面主体:main

页尾:footer

导航:nav

侧栏:sidebar

栏目:column

页面外围控制整体布局宽度:wrapper

(2) 导航

导航:nav

主导航:mainbar

子导航:subanv

顶导航:topnav

边导航:sidebar

左导航:leftsidebar

右导航:rightsidebar

菜单:menu

子菜单:submenu

摘要:summary

(3) 功能

标志:logo

广告:banner

登录:login

登陆条:loginbar

注册:regsiter

搜索:search

功能区:shop

标题:title

加入:joinus

状态:status

按钮:btn

滚动:scroll

标签页:tab

文章列表:list

提示信息:msg

当前的:current

小技巧:tips

图标:icon

注释:note

指南:guild

服务:service

版权:copyfight

友情链接:link

class命名

(1)颜色:使用颜色的名称或者16进制代码。如:

.red{color:red;}

.f60{color:#f60;}

.ff8600{color:#ff8600;}

(2)字体大小,直接使用“font+字体大小”作为名称,如:

.font12px{font-size:12px;}

.font9pt{font-size:9pt}

(3)对齐样式,使用对齐目标的因我名,如:

.left{float:left;}

.bottom{float:bottom;}

(4)标题栏样式,使用”类名+功能“的方式命名,如:

.barnews {}

.barproduct {}

推荐的css书写顺序

相关的属性声明应当归为一组,并按照下面的顺序排列:

Positioning

Box model

Typographic

Visual

由于定位(Positioning)可以从正常的文档流中移除元素,并且还能覆盖盒模型(box model)相关的样式,因此排在首位。盒模型拍在第二位,因为它决定了组件的尺寸和位置。

.xxx {

/* Positioning */

position: absolute;

top:0;

right:0;

bottom:0;

left:0;

z-index:100;

/* Box-model */

display: block;

float: right;

width: 100px;

height: 100px;

/* Typography */

font: normal 13px "Helvetica Neue", sans-serif;

line-height:1.5;

color:#333;

text-align: center;

/* Visual */

background-color:#f5f5f5;

border: 1px solid #e5e5e5;

border-radius: 3px;

/* Misc */

opacity:1;

}

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值