Attributes

Updated: 03/13/2021 by Computer Hope

Attributes may refer to any of the following:

1. With computer systems, attributes are the characteristics of a file in the context of a file system. For example, if the file had a read-only attribute, the file cannot have any changes (write protection), and can only be read. See our file attributes definition for further information about this type of an attribute.

2. Attrib is a command that allows you to adjust the attributes of a file in MS-DOS and Windows. See our attrib command page for further information on this command.

3. Within an HTML tag, an attribute dictates certain aspects of an element. Attributes are made up of a name and value pair. In the 'a' tag example below, "href" is an attribute name with the value "hope.html."

HTML tag

Do I need quotes around attribute values?

Yes. Although today's browsers can usually read attribute values with missing quotes around them, it is best practice to always have double quotes to prevent errors.

How many attributes can a tag have?

A tag could have as many valid attributes as needed as long as they're separated by a space and not duplicated. For example, in the following tag, the a tag has three different attribute names.

<a href="hope.html" class="big" style="color:red">Computer Hope</a>

In the above example, the link points to the hope.html file, uses the big class defined in a CSS file, and is stylized as red text.

How to add multiple attribute values

Multiple attribute values can be added by separating them with a space. For example, in the following example, we moved the font color into a CSS file and called it "red."

<a href="hope.html" class="big red">Computer Hope</a>

Is the order of attribute values important?

No. As long as the attribute values are contained in the tag they can be in any order.

4. When referring to an attribute in a word processor, it is a characteristic of a character, word, or line. For example, an underlined word has an underline attribute.

5. In database management systems, an attribute is sometimes used as a synonym for a field.

Archive attribute, Database terms, Display attribute, Flag, Operating system terms, Parameter, Permissions, Read-only, Read/Write, Software terms, Word processor terms, Write