HTML attribute_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:45:18
Original
1483 people have browsed it

HTML attributes provide additional information for HTML elements (providing more information about HTML elements).

Attributes always appear as name/value pairs, for example: name="value".

The

attribute is always specified in the opening tag of an HTML element.

<img src="1.jpg" alt="图片1" /><a href="www.aaa.html" title="aaa网址">aaa</a>
Copy after login

Explanation: The img element contains the src attribute and alt attribute; the a element contains the href and title attributes.

src attribute: Reference image, its value is the URL of the image file, which can be a relative path or an absolute path.

alt attribute: Specifies alternative text when the image cannot be displayed.

href attribute: used to specify the URL of the hyperlink target, which can be a relative path or an absolute path.

title attribute: Specifies additional information about the element. Try it: aaa Here we can move the mouse over the hyperlink text (aaa), and the title information (aaa URL) will appear.

Common Attributes

The following attributes are listed for most HTML elements:

属性 值 描述
class classname 规定元素的类名(classname)
id id 规定元素的唯一 id
style style_definition 规定元素的行内样式(inline style)
title text 规定元素的额外信息(可在工具提示中显示)

Develop good habits (XHTML attribute syntax specification)

  • XHTML attributes must be lowercase
  • Related labels:
    source:php.cn
    Statement of this Website
    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
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!