常用的CSS命名规则:
头:header
内容:content/container
尾:footer
导航:nav
侧栏:sidebar栏目:column
页面外围控制整体布局宽度:wrapper
左右中:left right center登录条:loginbar
标志:logo
广告:banner
页面主体:main 热点:hot新闻:news
下载:download
子导航:subnav
菜单:menu子菜单:submenu
搜索:search
友情链接:friendlink
页脚:footer版权:copyright
滚动:scroll
内容:content
标签页:tab文章列表:list
提示信息:msg
小技巧:tips
栏目标题:title加入:joinus
指南:guild
服务:service
注册:regsiter状态:status
投票:vote
合作伙伴:partner
id的命名:
(1)页面结构 容器: container 页头:header 内容:content/container 页面主体:main 页尾:footer 导航:nav 侧栏:sidebar 栏目:column 页面外围控制整体布局宽度:wrapper 左右中:left right center(2)导航 导航:nav 主导航:mainbav 子导航:subnav 顶导航:topnav 边导航:sidebar 左导航:leftsidebar 右导航:rightsidebar 菜单:menu 子菜单:submenu 标题: title 摘要: summary(3)功能 标志:logo 广告:banner 登陆:login 登录条:loginbar 注册:regsiter 搜索:search 搜索条:searchbar 功能区:shop 标题:title 加入:joinus 状态:status 按钮:btn 滚动:scroll 标签页:tab 文章列表:list 提示信息:msg 当前的: current 小技巧:tips 图标: icon 注释:note 指南:guild 服务:service 热点:hot 新闻:news 下载:download 投票:vote 合作伙伴:partner 友情链接:link 版权:copyright
注意事项:1)、所有的命名最好都小写2)、属性的值一定要用双引号("")括起来,且一定要有值如class="divcss5",id="divcss5"3)、每个标签都要有开始和结束,且要有正确的层次,排版有规律工整4)、空元素要有结束的tag或于开始的tag后加上"/"5)、表现与结构完全分离,代码中不涉及任何的表现元素,如style、font、bgColor、border等6)、
到的定义,应遵循从大到小的原则,体现文档的结构,并有利于搜索引擎的查询。7)、给每一个表格和表单加上一个唯一的、结构标记id8)、给图片加上alt标签9)、尽量使用英文命名原则10)、尽量不缩写,除非一看就明白的单词.
CSS样式命名
[if !supportLists]1. [endif]对齐样式命名:left(左边内容)、center(中间内容)、right(右边内容)等;
[if !supportLists]2. [endif]颜色英文命名:red(红色)、green(绿色)、yellow(黄色),又或者border_red(红色边框)等;
[if !supportLists]3. [endif]颜色代码命名:f00(红色)、ff0(黄色)、f90(橙色)等;
[if !supportLists]4. [endif]文字大小命名:font12px(字体12像素)、font16px(字体16像素)等;
[if !supportLists]5. [endif]页面线条命名:line_x (横线)、line_y (纵线)或 line_red(红线)、line_black(黑线)
[if !supportLists]6. [endif]图片图标命名:pic_1.jpg、pic_2.jpg 或 ico_1.gif、ico_2.gif
[if !supportLists]7. [endif]页面广告命名:ad_01、ad_02
[if !supportLists]8. [endif]背景框架命名:nav_bg(代表导航条的背景图片位置)、tool_bg(代表工具栏的背景图片位置)
Css文件命名规范
[if !supportLists]1. [endif]index.css:单独为首页建立样式
[if !supportLists]2. [endif]head.css:头部样式,多个页面头部设计风格相同时使用。
[if !supportLists]3. [endif]base.css:共用样式。
[if !supportLists]4. [endif]style.css:独立页面所使用的样式文件。
[if !supportLists]5. [endif]global.css:页面样式基础,全局公用样式,页面中必须包含。
[if !supportLists]6. [endif]layout.css:布局、版面样式,公用类型较多时使用,一般用在首页级页面和产品类页面中
[if !supportLists]7. [endif]module.css:模块,用于产品类页,也可与其它样式配合使用。
[if !supportLists]8. [endif]master.css:主要的样式表
[if !supportLists]9. [endif]columns.css:专栏样式
[if !supportLists]10. [endif]themes.css:主体样式
[if !supportLists]11. [endif]forms.css:表单样式
[if !supportLists]12. [endif]mend.css:补丁,基于以上样式进行的私有化修补。
页面结构命名
[if !supportLists]1. [endif]page:代表整个页面,用于最外层。
[if !supportLists]2. [endif]wrap:外套,将所有元素包在一起的一个外围包,用于最外层
[if !supportLists]3. [endif]wrapper:页面外围控制整体布局宽度,用于最外层
[if !supportLists]4. [endif]container:一个整体容器,用于最外层
[if !supportLists]5. [endif]head、header:页头区域,用于头部
[if !supportLists]6. [endif]nav:导航条
[if !supportLists]7. [endif]content:内容,网站中最重要的内容区域,用于网页中部主体
[if !supportLists]8. [endif]main:网站中的主要区域(表示最重要的一块位置),用于中部主体内容
[if !supportLists]9. [endif]column:栏目
[if !supportLists]10. [endif]sidebar:侧栏
[if !supportLists]11. [endif]foot、footer:页尾、页脚。网站一些附加信息放置区域,(或命名为copyright)用于底部
导航命名
[if !supportLists]1. [endif]nav、navbar、navigation、nav-wrapper:导航条或导航包,代表横向导航
[if !supportLists]2. [endif]topnav:顶部导航
[if !supportLists]3. [endif]mainbav:主导航
[if !supportLists]4. [endif]subnav:子导航
[if !supportLists]5. [endif]sidebar:边导航
[if !supportLists]6. [endif]leftsidebar 或 sidebar_a :左导航
[if !supportLists]7. [endif]rightsidebar 或 sidebar_b:右导航
[if !supportLists]8. [endif]title:标题
[if !supportLists]9. [endif]summary:摘要/li>
[if !supportLists]10. [endif]menu:菜单。区域包含一般的链接和菜单
[if !supportLists]11. [endif]submenu:子菜单
[if !supportLists]12. [endif]drop:下拉
[if !supportLists]13. [endif]dorpmenu:下拉菜单
[if !supportLists]14. [endif]links:链接菜单
功能命名
[if !supportLists]1. [endif]logo:标记网站logo标志
[if !supportLists]2. [endif]banner:标语、广告条、顶部广告条
[if !supportLists]3. [endif]login:登陆,(例如登录表单:form-login)
[if !supportLists]4. [endif]loginbar:登录条
[if !supportLists]5. [endif]regsiter:注册
[if !supportLists]6. [endif]tool、toolbar:工具条
[if !supportLists]7. [endif]search:搜索
[if !supportLists]8. [endif]searchbar:搜索条
[if !supportLists]9. [endif]searchlnput:搜索输入框
[if !supportLists]10. [endif]shop:功能区,表示现在的
[if !supportLists]11. [endif]icon:小图标
[if !supportLists]12. [endif]label:商标
[if !supportLists]13. [endif]homepage:首页
[if !supportLists]14. [endif]subpage:二级页面子页面
[if !supportLists]15. [endif]hot:热门热点
[if !supportLists]16. [endif]list:文章列表,(例如新闻列表:list-news)
[if !supportLists]17. [endif]scroll:滚动
[if !supportLists]18. [endif]tab:标签
[if !supportLists]19. [endif]sitemap:网站地图
[if !supportLists]20. [endif]msg 或 message:提示信息
[if !supportLists]21. [endif]current:当前的
[if !supportLists]22. [endif]joinus:加入
[if !supportLists]23. [endif]status:状态
[if !supportLists]24. [endif]btn:按钮,(例如搜索按钮可写成:btn-search)
[if !supportLists]25. [endif]tips:小技巧
[if !supportLists]26. [endif]note:注释
[if !supportLists]27. [endif]guild:指南
[if !supportLists]28. [endif]arr、arrow:标记箭头
[if !supportLists]29. [endif]service:服务
[if !supportLists]30. [endif]breadcrumb:(即页面所处位置导航提示)
[if !supportLists]31. [endif]download:下载
[if !supportLists]32. [endif]vote:投票
[if !supportLists]33. [endif]siteinfo:网站信息
[if !supportLists]34. [endif]partner:合作伙伴
[if !supportLists]35. [endif]link、friendlink:友情链接
[if !supportLists]36. [endif]copyright:版权信息
[if !supportLists]37. [endif]siteinfoCredits:信誉
[if !supportLists]38. [endif]siteinfoLegal:法律信息
以下为CSS样式命名与CSS文件命名参考表,DIV CSS命名集合:
CSS样式命名说明
网页公共命名
#wrapper页面外围控制整体布局宽度
#container或#content容器,用于最外层
#layout布局
#head, #header页头部分
#foot, #footer页脚部分
#nav主导航
#subnav二级导航
#menu菜单
#submenu子菜单
#sideBar侧栏
#sidebar_a, #sidebar_b左边栏或右边栏
#main页面主体
#tag标签
#msg #message提示信息
#tips小技巧
#vote投票
#friendlink友情连接
#title标题
#summary摘要
#loginbar登录条
#searchInput搜索输入框
#hot热门热点
#search搜索
#search_output搜索输出和搜索结果相似
#searchBar搜索条
#search_results搜索结果
#copyright版权信息
#branding商标
#logo网站LOGO标志
#siteinfo网站信息
#siteinfoLegal法律声明
#siteinfoCredits信誉
#joinus加入我们
#partner合作伙伴
#service服务
#regsiter注册
arr/arrow箭头
#guild指南
#sitemap网站地图
#list列表
#homepage首页
#subpage二级页面子页面
#tool, #toolbar工具条
#drop下拉
#dorpmenu下拉菜单
#status状态
#scroll滚动
.tab标签页
.left .right .center居左、中、右
.news新闻
.download下载
.banner广告条(顶部广告条)
电子贸易相关
.products产品
.products_prices产品价格
.products_description产品描述
.products_review产品评论
.editor_review编辑评论
.news_release最新产品
.publisher生产商
.screenshot缩略图
.faqs常见问题
.keyword关键词
.blog博客
.forum论坛
[if !supportLists]39. [endif]
CSS文件命名说明
master.css,style.css主要的
module.css模块
base.css基本共用
layout.css布局,版面
themes.css主题
columns.css专栏
font.css文字、字体
forms.css表单
mend.css补丁
print.css打印