Browse Definitions :


What is an attribute?

For example, eye color is an attribute of a person, while screen size is an attribute of a smartphone or TV. In computing and computer programming, an attribute is a changeable property or characteristic of some component of a program that can be set to different values.

What are attributes in computing?

In computing, the term attribute is used in many different contexts. In the context of a file system, it refers to a characteristic of a file in that system. So, a particular file can have a read-only attribute, which means it is write protected and can't be changed. Another file may not have this attribute, so a person or an application can both read and write to it.

Similarly, in an HTML tag used in building a web page, an attribute specifies certain aspects of an element on a page and could have a specific value.

In object-oriented programming, attributes are defined for classes and objects. It's a data element that represents the quality or state of the class or object.

object-orientated programming
Attributes in object-oriented programming are defined for classes and objects such as a data element representing the quality or state of the class or object.

An attribute defines a particular property of an object, element or file. It can also refer to a specific value for a given instance of that property. In most cases, a property owner would own these property attributes. All attributes are associated with a set of operations that determine what is and isn't possible to do with that attribute and the object, element or file it defines.

What are attributes in HTML?

In markup languages like Hypertext Markup Language (HTML) and Extensible Markup Language (XML), attributes describe data and data formatting. Thus, an attribute is usually a characteristic of an HTML page element, such as font color.

While programming in HTML, a user can set font attributes, such as size and color, to different values. Thus, p style="color:red" sets the paragraph attribute to red so the text will display in red. Similarly, they can set other attributes, such as font size, image path and web page language.

In short, different attributes provide additional information about HTML elements. They're usually written in the form of a name/value pair with the syntax name="value".

The most common attributes in HTML are:

1. href

The href attribute, represented by the <a> tag specifies the destination URL of the page a link goes to.


<a href="">What is attribute?</a>

2. src

The src attribute specifies the path/source of an image being displayed. It's accompanied by the <img> tag. The URL can be specified in two ways using the src attribute: absolute URL and relative URL.

The absolute URL links to an external image on a third-party website.


<img src =" ">

A relative URL links to an image hosted within the same website.


<img src =”img_phone.jpg ">

While both are valid, it's usually better to use relative URLs because the image won't break if the domain is changed. An absolute URL depends on an external website, so if its domain changes or goes down, the image will break and affect user experience (UX).

3. Width and Height

These attributes specify the width and height of the image in pixels. They're also used with the <img> tag.


<img src ="img_phone.jpg " width="260” height="480">

4. alt

The alt attribute specifies an alternate text for an image. This text tells the user what the image is about. It's indexed by search engines and also read aloud by screen reader software such as that used by visually impaired users. The alt attribute is especially important if the image is missing or broken, and is important from both an SEO and UX perspective.


<img src ="img_phone.jpg " alt="Android smartphone with stylus"">

5. style

The style attribute is used to add different styles to an HTML element, such as color, font or size.


<p style="color:purple;"> This is a purple paragraph.</p>

6. lang

The lang attribute, which is always included inside the <html> tag, declares the language of the web page to help search engines and browsers. A country code can be added to the language code if there are many country-level variants of a language. English is one such language.


<html lang="en"> for the US

<html lang="en-UK"> the United Kingdom

7. title

The title attribute adds extra information about an HTML element. Its value is displayed as a tooltip when a user mouses over that element.


<p title="I am a tooltip"> This is a paragraph.</p>

What is an attribute in a database management system?

In a database management system (DBMS), an attribute may describe the characteristics or properties of a component or entity, such as a database table or a field. If the database is compared to a spreadsheet, the attribute is simply one -- non-null -- cell or the conjunction of a particular column and row.

An entity in a DBMS may contain any number of attributes. If a row in the database contains invoice entries, attributes for these entries could include invoice number, date created, data paid and value. If the row contains student details, attributes could include name, date of birth or age, gender, address, roll number and phone number.

DBMS components
Attributes in a database management system describe the characteristics or properties of a component or entity, such as a database table or a field, while an entity can contain any number of attributes.

There are different types of attributes in a DBMS. These include:

Simple attributes

Simple attributes are independent and can't be classified further or subdivided into other components. They are also known atomic attributes.

An example of a simple attribute is the age of a person.

Composite attributes

Composite attributes can be subdivided into different components or subparts. One or more simple attributes form composite attributes.

A common example of a composite attribute is the address of a person, which can be composed of their street name, city name, ZIP code and country.

Single-valued attributes

Single-valued attributes contain a single value for each entity instance. These values remain constant and can't be subdivided into other attributes.

Date of birth, age and gender are all examples of single-valued attributes.

Multivalued attributes

Unlike single-valued attributes, multivalued attributes can store more than one value at a time from a set of possible values.

Email address and phone number are two examples, since a person can have more than one email address and phone number.

Derived attributes

Derived attributes draw their values from other attributes. One example is the age attribute that's derived from the date of birth attribute.

Key attributes

Key attributes can uniquely identify an entity from a set. These attributes always have non-repeating values. An example is a person's social security number, which is unique to an individual.

Complex attributes

Complex attributes are formed by combining multivalued and composite attributes. They usually have many subsections and are rarely used in DBMS.

For example, an attribute called "addr_emph" represents a person's physical address, email address and phone number. The address is a composite attribute, while the phone number and email address are multivalued attributes. Combining them creates the complex attribute.

Stored attributes

Stored attributes have fixed values for an entity. They also help to set derived attributes. For example, age is a derived attribute of date of birth, while date of birth is a stored attribute of age.

What are attributes in DOS?

In the disk OS (DOS), file properties like read-only or visible are known as file attributes. These attributes are the metadata of a DOS file and may include the following properties:

The attrib command is used to display or change file attributes. The most common options are:

Options (with attrib) Action


Sets an attribute


File is read-only


Archive file


Clears an attribute


System file


Hidden file

Learn about relational databases, how to create an HTML5 and PHP file upload form for Apache and explore the difference between functional and object-oriented programming.

This was last updated in September 2022

Continue Reading About attribute

  • voice over LTE (VoLTE)

    Voice over LTE (VoLTE) is a digital packet technology that uses 4G LTE networks to route voice traffic and transmit data.

  • ONOS (Open Network Operating System)

    Open Network Operating System (ONOS) is an OS designed to help network service providers build carrier-grade software-defined ...

  • telematics

    Telematics is a term that combines the words telecommunications and informatics to describe the use of communications and IT to ...

  • three-factor authentication (3FA)

    Three-factor authentication (3FA) is the use of identity-confirming credentials from three separate categories of authentication ...

  • cyber espionage

    Cyber espionage (cyberespionage) is a type of cyber attack that malicious hackers carry out against a business or government ...

  • role-based access control (RBAC)

    Role-based access control (RBAC) is a method of restricting network access based on the roles of individual users within an ...

  • project charter

    A project charter is a formal short document that states a project exists and provides project managers with written authority to...

  • leadership

    Leadership is the ability of an individual or a group of people to influence and guide followers or members of an organization, ...

  • transaction

    In computing, a transaction is a set of related tasks treated as a single action.

  • employee engagement

    Employee engagement is the emotional and professional connection an employee feels toward their organization, colleagues and work.

  • talent pool

    A talent pool is a database of job candidates who have the potential to meet an organization's immediate and long-term needs.

  • diversity, equity and inclusion (DEI)

    Diversity, equity and inclusion is a term used to describe policies and programs that promote the representation and ...

Customer Experience
  • sales development representative (SDR)

    A sales development representative (SDR) is an individual who focuses on prospecting, moving and qualifying leads through the ...

  • service level indicator

    A service level indicator (SLI) is a metric that indicates what measure of performance a customer is receiving at a given time.

  • customer data platform (CDP)

    A customer data platform (CDP) is a type of software application that provides a unified platform of customer information that ...