Language
日本語
English

Caution

JavaScript is disabled in your browser.
This site uses JavaScript for features such as search.
For the best experience, please enable JavaScript before browsing this site.

  1. Home
  2. HTML Tag Dictionary
  3. style / title / lang

style / title / lang

The style, title, and lang attributes are global attributes that can be specified on almost all HTML elements. Use style to apply inline CSS, title to display a tooltip, and lang to specify the language of the text within an element.

Syntax

<!-- Applying inline styles -->
<p style="color: red; font-size: 1.2rem;">Red text.</p>

<!-- Specifying a tooltip -->
<abbr title="HyperText Markup Language">HTML</abbr>

<!-- Specifying a language -->
<p lang="en">This paragraph is written in English.</p>

Attribute list

AttributeDescription
styleApplies inline CSS styles to an element. Write CSS properties separated by semicolons.
titleSpecifies a title or additional information for an element. Most browsers display this as a tooltip on mouseover.
langSpecifies the language of the text within an element. Uses BCP 47 language codes (e.g., ja, en, zh).

Sample code

<!-- Applying inline CSS with style -->
<p style="color: #e74c3c; font-weight: bold;">Important notice</p>

<!-- Displaying a tooltip with title -->
<p>
  For abbreviations, use the <abbr title="HyperText Markup Language">HTML</abbr> element
  with the <code title="Short for abbreviation">abbr</code> tag and
  the title attribute.
</p>

<!-- Specifying the language for each paragraph -->
<p lang="en">日本語のテキストです。</p>
<p lang="en">This is English text.</p>

<!-- The title attribute on img works as a tooltip -->
<img src="photo.jpg" alt="風景写真" title="北海道の雪景色(2024年1月撮影)">

Result

A paragraph with style applied is displayed in bold red text. Hovering over an element with a title attribute shows the specified text as a tooltip. The lang attribute communicates language information to browsers and screen readers but does not affect the visual appearance.

Notes

The style attribute is convenient for quickly testing styles or dynamically changing styles with JavaScript, but writing styles directly in HTML as inline styles reduces maintainability. It is generally recommended to use an external CSS file or a style tag instead.

The title attribute can be specified on any element, but it is mainly used to expand abbreviations (<abbr>) or to provide supplementary descriptions for links. Since tooltips are not displayed on touch devices such as smartphones, avoid relying solely on title for important information — include it in the body text as well.

The lang attribute is typically written on the <html> tag to specify the language for the entire page, but it can also be applied to individual elements when multiple languages are mixed within a page. Screen readers use the lang attribute to read content in the correct language, making it an important attribute for accessibility.

Browser Support

Chrome Chrome
49+
Supported in all versions
Firefox Firefox
57+
Supported in all versions
Safari Safari
18+
Supported in all versions
Edge Edge
80+
11 or earlier ×
IE IE
11 or earlier ×
Opera Opera
48+
14 or earlier ×
iOS Safari iOS Safari
18+
Supported in all versions
Android Browser Android Browser
37+
4 or earlier ×
Chrome Android Chrome Android
36+
17 or earlier ×
Firefox Android Firefox Android
79+
3 or earlier ×

If you find any errors or copyright issues, please .