如何使用W3C Validator验证网页上HTML,JavaScript,CSS?

Validating web pages and contents like HTML, JavaScript, and CSS are important for web sites and application owners. As they are popular technologies they have a lot of different implementations where they can be a bit different from the standard. W3C provides a validator to check and provide feedback about the given web page.

验证网页和HTML,JavaScript和CSS等内容对于网站和应用程序所有者非常重要。 由于它们是流行的技术,因此它们具有许多不同的实现方式,它们与标准可能有所不同。 W3C提供了一个验证器来检查并提供有关给定网页的反馈。

什么是W3C(万维网联盟)? (What is W3C (World Wide Web Consortium)?)

World Wide Web Consortium (W3C) is an international community where its members, staff try to drive Web standards forward. The main standard W3C working is HTML which is created by Tim Berners-Lee. As a standardizing entity, W3C provides standards and tools to set and check HTML. W3C provides HTML, JavaScrip and CSS validator for web pages.

万维网联盟(W3C)是一个国际社区,其成员,工作人员试图推动Web标准向前发展。 W3C的主要标准工作是由Tim Berners-Lee创建HTML。 作为一个标准化实体,W3C提供了用于设置和检查HTML的标准和工具。 W3C为网页提供HTML,JavaScrip和CSS验证器。

W3C验证器 (W3C Validator)

The W3C Markup Validator is provided from the Markup Validation Service page. We can see that the W3C Markup Validation service provides some options about delivering web pages and the validation configuration.

W3C标记验证器是从“标记验证服务”页面提供的。 我们可以看到W3C标记验证服务提供了一些有关交付网页和验证配置的选项。

https://validator.w3.org/

https://validator.w3.org/

W3C Validator
W3C Validator Web Page
W3C验证器网页

验证交付方式/方法(Validation Delivery Ways/Methods)

From the screenshot, we can see that a web page can be delivered in 3 different ways.

从屏幕截图中,我们可以看到可以以3种不同方式交付网页。

通过URI / URL验证 (Validate By URI/URL)

Validate by URI will accept the URI or URL of the web page on the internet. Then we will click to the Check button. This delivery method is also the default and most popular way.  In this example, we will check the www.poftut.com web page which is Poftut’s home page.

Validate by URI将接受Internet上网页的URI或URL。 然后,我们将单击“ Check按钮。 这种传递方法也是默认的也是最流行的方法。 在此示例中,我们将检查Poftut主页的www.poftut.com网页。

Validate By URI/URL
Validate By URI/URL
通过URI / URL验证

通过文件上传验证(Validate By File Upload)

We can also deliver the web page from the local system by uploading it to the Markup Validation Service. We will select the Validate by File Upload and then click to the check. Keep in mind that some Internet Explorer versions may not work with this method.

我们还可以通过将网页上传到标记验证服务来从本地系统交付该网页。 我们将选择“ Validate by File Upload ,然后单击以进行检查。 请记住,某些Internet Explorer版本可能不适用于此方法。

Validate By File Upload
Validate By File Upload
通过文件上传验证

通过直接输入验证(Validate By Direct Input)

We can also provide the Markup Code (HTML, JavaScript, CSS) directly to the text editor of the Markup Validation Service. We will use Validate by Direct Input like below.

我们还可以直接将标记代码(HTML,JavaScript,CSS)提供给标记验证服务的文本编辑器。 我们将使用如下所示的“ Validate by Direct Input

Validate By Direct Input
Validate By Direct Input
通过直接输入验证

HTML /标记验证选项(HTML/Markup Validation Options)

We have learned the methods to validate HTML/Markup. But there are some options that can be used during validation. We can list these options by clicking to the More Options like below.

我们已经学习了验证HTML /标记的方法。 但是在验证过程中可以使用一些选项。 我们可以通过单击下面的“ More Options来列出这些选项。

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vue Validator是一个用于Vue.js的表单验证插件,可以方便地对表单进行验证。下面详细介绍一下Vue Validator使用方法。 首先,我们需要在Vue项目中安装Vue Validator。可以通过命令`npm install vue-validator`来安装该插件。 安装完成后,在Vue组件中,需要先引入Vue Validator,并在`Vue.use(VueValidator)`中启用它。 接着,在需要进行验证的表单中,添加一个`validator`属性来指定验证规则。可以使用`v-validate`指令来设置验证规则。例如: ```html <input type="text" v-model="name" v-validate="'required|alpha'"> ``` 在上述代码中,我们使用`v-validate`指令来设置验证规则为必填(required)和只允许字母(alpha)。 然后,在表单中,可以使用`v-show`指令来根据验证结果来显示或隐藏错误信息。例如: ```html <div v-show="$validator.name.required">姓名不能为空</div> <div v-show="$validator.name.alpha">姓名只能包含字母</div> ``` 在上述代码中,使用`v-show="$validator.name.required"`来根据`name`字段的必填验证结果来显示或隐藏错误信息。 此外,还可以在Vue组件中定义自定义验证规则。可以使用`Vue.validator`方法来定义自定义验证规则。例如: ```javascript Vue.validator('customRule', function(val) { return val === 'validValue'; }); ``` 在上述代码中,我们自定义了一个验证规则`customRule`,它的值必须等于`'validValue'`。这样,我们就可以在表单中使用`v-validate="'customRule'"`来应用该自定义规则。 总结一下,Vue Validator使用方法包括:安装插件、启用插件、设置验证规则、显示错误信息以及自定义验证规则。以上就是Vue Validator使用方法的详细解释。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值