网页制作中规范使用 DIV+CSS 命名规则,可以改善优化功效特别是团队合作时候可以提供合作制作效率,具体 DIV CSS命名规则CSS命名大全 内容篇。
常用DIV+CSS命名大全集合,即CSS命名规则
DIV CSS命名目录- 命名规则说明
- 重要CSS命名
- CSS命名参考表
- 命名技巧
我们开发 CSS+DIV网页(Xhtml)时候,比较困惑和纠结的事就是 CSS命名,特别是新手不知道什么地方该如何命名,怎样命名才是好的方法。
一、命名规则说明: - TOP
1)、所有的命名最好都小写
2)、属性的值一定要用双引号("")括起来,且一定要有值如class="divcss5",id="divcss5"
3)、每个标签都要有开始和结束,且要有正确的层次,排版有规律工整
4)、空元素要有结束的tag或于开始的tag后加上"/"
5)、表现与结构完全分离,代码中不涉及任何的表现元素,如style、font、bgColor、border等
6)、
到的定义,应遵循从大到小的原则,体现文档的结构,并有利于搜索引擎的查询。
7)、给每一个表格和表单加上一个唯一的、结构标记id
8)、给图片加上alt标签
9)、尽量使用英文命名原则
10)、尽量不缩写,除非一看就明白的单词
DIVCSS5给大家介绍常见CSS命名和 DIV CSS命名方法。
二、相对网页外层重要部分CSS样式命名: - TOP
外套 wrap ------------------用于最外层
头部 header ----------------用于头部
主要内容 main ------------用于主体内容(中部)
左侧 main-left -------------左侧布局
右侧 main-right -----------右侧布局
导航条 nav -----------------网页菜单导航条
内容 content ---------------用于网页中部主体
底部 footer -----------------用于底部
三、DIV+CSS命名参考表: - TOP
以下为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 | 论坛 |
CSS文件命名 | 说明 |
---|---|
master.css,style.css | 主要的 |
module.css | 模块 |
base.css | 基本共用 |
layout.css | 布局,版面 |
themes.css | 主题 |
columns.css | 专栏 |
font.css | 文字、字体 |
forms.css | 表单 |
mend.css | 补丁 |
print.css | 打印 |
CSS命名其它说明:
DIV+CSS命名小结:无论是使用“.”(小写句号)选择符号开头命名,还是使用“#”(井号)选择符号开头命名都无所谓,但我们最好遵循, 主要的、 重要的、 特殊的、 最外层的盒子用“#”(井号)选择符号开头命名,其它都用“.”(小写句号)选择符号开头命名,同时考虑命名的 CSS选择器在HTML中重复使用调用。
通常我们最常用主要命名有:wrap(外套、最外层)、header(页眉、头部)、nav(导航条)、menu(菜单)、title(栏目标题、一般配合h1\h2\h3\h4标签使用)、content (内容区)、footer(页脚、底部)、logo(标志、可以配合h1标签使用)、banner(广告条,一般在顶部)、copyRight(版权)。其它可根据自己需要选择性使用。
DIVCSS5建议:主要的、重要的、最外层的盒子用“#”(井号)选择符号开头命名,其它都用“.”(小写句号)选择符号开头命名。
2. CSS样式文件命名如下
主要的 master.css
布局,版面 layout.css
专栏 columns.css
文字 font.css
打印样式 print.css
主题 themes.css
四、英文命名技巧: - TOP
如果遇到不常用的,可以借助翻译工具进行翻译取其英文命名。
推荐使用谷歌在线翻译工具:http://translate.google.cn/
谷歌翻译工具 介绍: http://www.divcss5.com/css-tool/t346.shtml
也许你需要了解一下 css引用到 html方法
以上为DIV+CSS的命名规则总结,相信通过规范的 CSS命名给你以后网站网页的维护带来方便。
如需转载,请注明文章出处和来源网址: http://www.divcss5.com/jiqiao/j4.shtml

The function of HTML is to define the structure and content of a web page, and its purpose is to provide a standardized way to display information. 1) HTML organizes various parts of the web page through tags and attributes, such as titles and paragraphs. 2) It supports the separation of content and performance and improves maintenance efficiency. 3) HTML is extensible, allowing custom tags to enhance SEO.

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1
Powerful PHP integrated development environment

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool