Web 前端最复杂的部分莫过于 CSS 了,细枝末节就算是规范自己也很难解释清楚。有一点我非常难以理解,规范为什么要浪费那么大精力去解释每一个 CSS 属性混用会产生的结果呢?如果每次添加一个新特性都要把先前的所有特性都考虑以便,那岂不是只会越来越笨拙?
我觉得,CSS 应该更强制化。比如给 table-cell 设置 float 甚至 position: absolute 这样的奇葩行为,该报错的直接报错,不要再去想应该怎么计算。因为没有什么场景是必须使用这样的黑魔法解决的,如果真有这样的场景那只能说 CSS 本身还不够强大。而且,就算规范中定义了这些细节,又有多少人能真正记住呢?
CSS 2.1 本身就已经是很大的一坨东西了,然后 CSS 3 又加入了一大坨特性,这些特性互相作用的结果就是让规范成倍地变厚。就像一部法律,如果它过于复杂,那么能够驾驭的人就越来越少,实用性越来越低。然而法律复杂还是情有可原的,因为具体的细节无法逃避,但是一个编码规范如此复杂有什么用?
该出现 UB 的地方就尽管顺其自然吧?即使强行去定义这些不合理的行为,并加入规范中,开发者可能也不敢去依赖这种特性。这样的东西应该称为「边缘行为(EB:Edge Behavior)」,同 UB 一样是不可靠的,说不定下一个版本的规范又会做调整呢?
很多人觉得,是历史包袱导致了改革无法顺利进行?其实看看 ES 规范,strict mode 就是一个非常好用的甩锅神器。增加一个严格模式,并且禁用掉很多历史遗留的特性,这样就可以名正言顺地引入新特性且不用考虑旧版兼容了。
说到严格模式,其实 XHTML 曾经也有严格模式,但后来的 HTML 5 太火,后来就没人再鸟 XHTML 了。总之我的观点就是,像 HTML、CSS 这样通用的东西,规范不该把精力浪费在没卵用的 EB 制定上,任其 UB 也完全没问题。

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.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.


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

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software