search
HomeWeb Front-endHTML TutorialFront-end specification_html/css_WEB-ITnose

参考资料:

https://github.com/ecomfe/spec(百度)

通过分析github代码库总结出来的工程师代码书写习惯

NEC更好的解决方案(网易)

说明:

     红字为重要, 黄字为不确定或不会, 参1~n为参考的资料链接

  本来整理在印象笔记,无序列表在博客园编辑器显示不正常,望谅解

  转载请注明出处,建议请留言谢谢。

系列文章

     前端规范1-HTML规范

  前端规范2-CSS规范

 

  HTML嵌套规则

 

敬请期待

  HTML闭合标签

  HTML与CSS属性书写顺序

  更好的利用title与alt属性

  如何正确的使用HTML标题

总的原则

实用高于完美

     尽量遵循 HTML 标准和语义,但是不应该以浪费实用性作为代价。

     任何时候都要用尽量小的复杂度和尽量少的标签来解决问题。

     重要内容的代码尽量靠前,利于SEO

dome结构

  1. dome
    1. index.html(静态页面)
    2. styles
      1. reset.css
      2. style
    3. scripts
      1. jquery-1.8.2.min.js
      2. script.js
    4. images
      1. bg

DOME(百度云下载:http://pan.baidu.com/s/1hqAaST2)

index.html

 1 <!DOCTYPE html> 2 <html lang="zh-CN"> 3 <head> 4     <meta charset="UTF-8"/> 5     <title>标题</title> 6     <meta name="keywords" content=""/> 7     <meta name="description" content=""/> 8  9     <link rel="stylesheet" href="styles/reset.css"/>10     <link rel="shortcut icon" href="images/bg/favicon.ico"/>11 12     <link rel="stylesheet" href="style/style.css">13     <script src="./scripts/jquery-1.8.2.min.js"></script>14     <script src="./scripts/script.js"></script>15 </head>16 <body>17     18 </body>19 </html>

reset.css

 1 /* reset */ 2 html,body,h1,h2,h3,h4,h5,h6,div,dl,dt,dd,ul,ol,li,p,blockquote,pre,hr,figure,table,caption,th,td,form,fieldset,legend,input,button,textarea,menu{margin:0;padding:0;} 3 header,footer,section,article,aside,nav,hgroup,address,figure,figcaption,menu,details{display:block;} 4 table{border-collapse:collapse;border-spacing:0;} 5 caption,th{text-align:left;font-weight:normal;} 6 html,body,fieldset,img,iframe,abbr{border:0;} 7 i,cite,em,var,address,dfn{font-style:normal;} 8 [hidefocus],summary{outline:0;} 9 li{list-style:none;}10 h1,h2,h3,h4,h5,h6,small{font-size:100%;}11 sup,sub{font-size:83%;}12 pre,code,kbd,samp{font-family:inherit;}13 q:before,q:after{content:none;}14 textarea{overflow:auto;resize:none;}15 label,summary{cursor:default;}16 a,button{cursor:pointer;}17 h1,h2,h3,h4,h5,h6,em,strong,b{font-weight:bold;}18 del,ins,u,s,a,a:hover{text-decoration:none;}19 body,textarea,input,button,select,keygen,legend{font:12px/1.14 arial,\5b8b\4f53;color:#333;outline:0;}20 body{background:#fff;}21 /*a,a:hover{color:#333;}*/22 /* /reset */23 24 /* 通用样式 */25 26 /* /通用样式 */

script.js

1 window.onload=function(){2 3 }4 $(function(){5     6 })

 

文件夹命名

方案一(适合一般项目):

  • 项目名
  • index.html(静态页面)
  • styles
  • reset.css
  • scripts
  • jquery.js
  • images
  • bg
  • bg1.png
  • img1.jpg
  • 方案二(适合较小项目):

  • 项目名
  • index.html(静态页面)
  • img
  • reset.css
  • music.mp3
  • jquery.js
  • images
  • bg
  • bg1.png
  • img1.jpg
  • 备:如果由多个单词组成,使用-连接符连接

    上面bg即为背景图,包括各种logo,按钮背景,CSS Sprite等等

     

    Statement
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Explain the importance of using consistent coding style for HTML tags and attributes.Explain the importance of using consistent coding style for HTML tags and attributes.May 01, 2025 am 12:01 AM

    A consistent HTML encoding style is important because it improves the readability, maintainability and efficiency of the code. 1) Use lowercase tags and attributes, 2) Keep consistent indentation, 3) Select and stick to single or double quotes, 4) Avoid mixing different styles in projects, 5) Use automation tools such as Prettier or ESLint to ensure consistency in styles.

    How to implement multi-project carousel in Bootstrap 4?How to implement multi-project carousel in Bootstrap 4?Apr 30, 2025 pm 03:24 PM

    Solution to implement multi-project carousel in Bootstrap4 Implementing multi-project carousel in Bootstrap4 is not an easy task. Although Bootstrap...

    How does deepseek official website achieve the effect of penetrating mouse scroll event?How does deepseek official website achieve the effect of penetrating mouse scroll event?Apr 30, 2025 pm 03:21 PM

    How to achieve the effect of mouse scrolling event penetration? When we browse the web, we often encounter some special interaction designs. For example, on deepseek official website, �...

    How to modify the playback control style of HTML videoHow to modify the playback control style of HTML videoApr 30, 2025 pm 03:18 PM

    The default playback control style of HTML video cannot be modified directly through CSS. 1. Create custom controls using JavaScript. 2. Beautify these controls through CSS. 3. Consider compatibility, user experience and performance, using libraries such as Video.js or Plyr can simplify the process.

    What problems will be caused by using native select on your phone?What problems will be caused by using native select on your phone?Apr 30, 2025 pm 03:15 PM

    Potential problems with using native select on mobile phones When developing mobile applications, we often encounter the need for selecting boxes. Normally, developers...

    What are the disadvantages of using native select on your phone?What are the disadvantages of using native select on your phone?Apr 30, 2025 pm 03:12 PM

    What are the disadvantages of using native select on your phone? When developing applications on mobile devices, it is very important to choose the right UI components. Many developers...

    How to optimize collision handling of third-person roaming in a room using Three.js and Octree?How to optimize collision handling of third-person roaming in a room using Three.js and Octree?Apr 30, 2025 pm 03:09 PM

    Use Three.js and Octree to optimize collision handling of third-person roaming in the room. Use Octree in Three.js to implement third-person roaming in the room and add collisions...

    What problems will you encounter when using native select on your phone?What problems will you encounter when using native select on your phone?Apr 30, 2025 pm 03:06 PM

    Issues with native select on mobile phones When developing applications on mobile devices, we often encounter scenarios where users need to make choices. Although native sel...

    See all articles

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

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

    Hot Tools

    WebStorm Mac version

    WebStorm Mac version

    Useful JavaScript development tools

    Dreamweaver Mac version

    Dreamweaver Mac version

    Visual web development tools

    ZendStudio 13.5.1 Mac

    ZendStudio 13.5.1 Mac

    Powerful PHP integrated development environment

    PhpStorm Mac version

    PhpStorm Mac version

    The latest (2018.2.1) professional PHP integrated development tool

    EditPlus Chinese cracked version

    EditPlus Chinese cracked version

    Small size, syntax highlighting, does not support code prompt function