一、web标准
很多人把web标准挂在嘴边,却没有引起足够重视,只关注页面外在的表现而忽略页面本身代码的质量。
标准的页面具有哪些优点?
-
保证浏览器正确渲染 最大限度的保证页面在不同浏览器正常解析,同时还能最大限度保证在未来的各种客户端中正常解析。
-
更容易被搜索引擎搜寻,提高网站搜索排名。标准的页面基本完成了一半的搜索引擎优化工作,搜索引擎的网络“爬虫”目的是读懂网站的内容,并找出网站关键字。合理使用标签和属性,可以帮助搜索引擎准确理解网站内容。
-
提高网站易用性。让网站能被更多用户访问,比如视力或肢体障碍用户。
-
更好的维护和扩展。 多个开发者如果遵循统一的标准,则会更好的理解和维护已有的页面。标签、样式、以及行为分离的标准页面显然具有更好的扩展性。
-
标准的HTML页面结构,比如文档类型声明、head(title和引入的文件)、body等。
-
正确闭合标签。
-
停止使用不标准的标签和属性,简化代码。
-
样式和结构分离。
-
添加javascript禁用的提示信息。
-
添加必要的标签,比如常用的keywords、description,设置IE浏览器的兼容模式,设置页面在移动设备中的显示等。
如何做到标准?
二、高可读性HTML
一些小原则
1、注意标签语义化,网页的外观看起来怎样跟浏览器的解析以及搜索引擎的抓取毫无关系,高可读性的html代码除了使开发者自身更易看懂和维护之外,最重要还是给机器去读的。
2、没必要使用的标签就不要用,可以利用其它的方法去做到同样的效果,比如伪元素。 比较常见的使用不当之处有“分隔符”和“空标签清除浮动”等。
3、使用一些非文字内容的时候,虽然看似使用空标签配合css就可以完成,但搜索引擎却不能得知它的作用,可以添加一些文字说明,然后再用css将其隐藏。这样做也便于第三方阅读工具的识别。
4、熟悉各标签上规范的属性,给html标签添加必要的属性 比如常见的:alt、title、for等。
5、
应仅用于文本内容的换行,不应用于行级元素的换行。
6、网页中的图片是使用还是background? 若作为页面内容的一部分,则使用img,若仅用于装饰,使用background。
常用几类标签的正确使用方式
网页标题层级
标题标签指的是h1~h6这6个标签,统称hx标签,相比其他的语义标签,
(1)在标题处应使用。
(2)页面中只使用一个h1标签,搜索引擎会给予它最高权重。其他模块标题标签从h2开始。
(3)
(4)不要单纯使用
正确设计表单
(1)不要使用

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,

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

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

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

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

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

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

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


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

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

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

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

Atom editor mac version download
The most popular open source editor
