content
content attribute
The content
attribute in HTML is primarily used with the <meta>
tag to define metadata
, such as the page description
, keywords
, or author
. It works alongside the name
or http-equiv
attributes to provide meaningful information about the webpage.
Syntax
<meta name="value" content="text">
Example
The meta elements in this document define its description and keywords.
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML, CSS, XML, JavaScript">
</head>
<body>
<p>The meta elements in this document define its description and keywords.</p>
</body>
</html>
content
attribute provides essential metadata
such as the page description
, keywords
, and author details
.Applies To
The content
attribute is used with the following element:
Element | Attribute |
---|---|
<meta> | content |
Conclusion
The content
attribute plays a key role in defining metadata, enhancing SEO, and improving browser behavior. Primarily used within the <meta>
tag, it helps provide information such as descriptions
, keywords
, and authorship
. Utilizing the content
attribute effectively allows developers to optimize webpages for search engines and enhance accessibility.
class
The class attribute in HTML assigns one or more class names to an element, allowing for CSS styling and JavaScript manipulation of groups of elements.
contenteditable
The contenteditable attribute in HTML allows users to edit the content of an element directly in the browser, enabling real-time modifications.