English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Comprehensive CSS Properties

CSS #id Selector

Complete CSS Selector Reference Manual

Online Example

For id="my-id" element adds the specified style:

<!DOCTYPE html>
<html>
<title>Basic Tutorial Website (oldtoolbag.com)</title>/title>
<head>
<style>
#my-id
{
background-color:red;
}
</style>
</head>
<body>
<h1>Welcome to my homepage</h1>
<div id="my-id">
<p>My name is Rabbit Baby.</p>/p>
<p>I live in Canada.</p>/p>
</div>
<p>My best friend is Lili.</p>/p>
</body>
</html>
Test and see ‹/›

Definition and Usage

#idThe selector specifies the style of elements with ID attributes.

Browser Compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support #id Selector.

Complete CSS Selector Reference Manual