Home  >  Article  >  Web Front-end  >  What symbols are used on both sides of html5 attribute values?

What symbols are used on both sides of html5 attribute values?

青灯夜游
青灯夜游Original
2021-12-15 18:05:031965browse

In HTML5, the attribute value is wrapped in English double quotes """ and """ or single quotes "'" and "'", and the syntax is "attribute name="attribute value"" or " Attribute = 'attribute value'"; although both double quotes and single quotes can surround attribute values, for the sake of standardization and professionalism, try to use double quotes.

What symbols are used on both sides of html5 attribute values?

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

What are attributes

Attributes can provide some additional information for HTML tags, or modify HTML tags. Attributes need to be added in the start tag, and the syntax format is:

attr="value"
attr='value'

attr represents the attribute name, value represents the attribute value. Attribute values ​​must be surrounded by double quotes "" or single quotes ''.

Note that although both double quotes and single quotes can surround attribute values, for the sake of standardization and professionalism, please use double quotes as much as possible.

A tag can have no attributes, or it can have one or more attributes.

Examples of using HTML attributes:

<p id="user-info" class="color-red">欢迎 <font color="red" size="3">Tom</font> 来到PHP中文网!<p>
<div class="clearfloat">
    <p class="left">这里显示 Tom 的账号信息</p>
    <p class="right">这里显示 Tom 的个性签名</p>
</div>

Special properties

There are many HTML attributes, which can be roughly divided into two categories:

Some attributes apply to most or all HTML tags, we call these attributes universal attributes;

Some attributes only apply to one or a few specific HTML tags, we call these attributes special attributes.

The What symbols are used on both sides of html5 attribute values? tag in HTML has two special attributes, src and alt. The tag also has two special attributes, href and target, as shown in the following example:

<img src="./logo.png" alt="PHP中文网Logo" width="100"    style="max-width:90%">
<a href="http://c.biancheng.net/" target="_blank">PHP中文网</a>

Description of the code:

Custom attributes

In addition to its own attributes, HTML also allows us to customize attributes. Although these attributes can be recognized by the browser, But it will not add any special effects. We need to use CSS and JavaScript to process custom attributes and add specified styles or behaviors to HTML tags.

What symbols are used on both sides of html5 attribute values?

Recommended tutorial: "

html video tutorial"

The above is the detailed content of What symbols are used on both sides of html5 attribute values?. For more information, please follow other related articles on the PHP Chinese website!

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