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
    Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update?Mar 04, 2025 pm 12:32 PM

    The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

    How do I use HTML5 form validation attributes to validate user input?How do I use HTML5 form validation attributes to validate user input?Mar 17, 2025 pm 12:27 PM

    The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

    How to efficiently add stroke effects to PNG images on web pages?How to efficiently add stroke effects to PNG images on web pages?Mar 04, 2025 pm 02:39 PM

    This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

    What are the best practices for cross-browser compatibility in HTML5?What are the best practices for cross-browser compatibility in HTML5?Mar 17, 2025 pm 12:20 PM

    Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

    What is the purpose of the <datalist> element?What is the purpose of the <datalist> element?Mar 21, 2025 pm 12:33 PM

    The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

    What is the purpose of the <meter> element?What is the purpose of the <meter> element?Mar 21, 2025 pm 12:35 PM

    The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

    How do I use the HTML5 <time> element to represent dates and times semantically?How do I use the HTML5 <time> element to represent dates and times semantically?Mar 12, 2025 pm 04:05 PM

    This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit

    What is the purpose of the <progress> element?What is the purpose of the <progress> element?Mar 21, 2025 pm 12:34 PM

    The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

    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

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
    Repo: How To Revive Teammates
    1 months agoBy尊渡假赌尊渡假赌尊渡假赌
    Hello Kitty Island Adventure: How To Get Giant Seeds
    4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Safe Exam Browser

    Safe Exam Browser

    Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

    SublimeText3 Linux new version

    SublimeText3 Linux new version

    SublimeText3 Linux latest version

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)