From 4b1a9203c547c019fc5398082ae19a3f3d4c3efe Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:41:15 -0500 Subject: initial commit --- files/ca/web/css/selectors_id/index.html | 134 +++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 files/ca/web/css/selectors_id/index.html (limited to 'files/ca/web/css/selectors_id') diff --git a/files/ca/web/css/selectors_id/index.html b/files/ca/web/css/selectors_id/index.html new file mode 100644 index 0000000000..1b6f041eb6 --- /dev/null +++ b/files/ca/web/css/selectors_id/index.html @@ -0,0 +1,134 @@ +--- +title: Selector ID +slug: Web/CSS/Selectors_ID +tags: + - CSS + - Reference + - Selectors +translation_of: Web/CSS/ID_selectors +--- +
{{CSSRef}}
+ +

En un document HTML, el selector ID CSS coincideix amb un element basat en el valor del seu atribut {{htmlattrxref("ID")}}. L'atribut ID de l'element seleccionat ha de coincidir exactament amb el valor indicat en el selector

+ +
/* The element with id="demo" */
+div#demo {
+  border: red 2px solid;
+}
+ +

Sintaxi

+ +
#id_value { style properties }
+ +

Recordeu que això és equivalent al següent {{Cssxref("Attribute_selectors", "attribute selector")}}:

+ +
[id=id_value] { style properties }
+ +

Exemple

+ +

CSS

+ +
div#identified {
+  background-color: skyblue;
+}
+
+ +

HTML

+ +
<div id="identified">This div has a special ID on it!</div>
+<div>This is just a regular div.</div>
+
+ +

Resultat

+ +

{{EmbedLiveSample("Example", '100%', 50)}}

+ +

Especificacions

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
EspecificacióEstatComentari
{{SpecName("CSS4 Selectors", "#id-selectors", "ID selectors")}}{{Spec2("CSS4 Selectors")}} 
{{SpecName("CSS3 Selectors", "#id-selectors", "ID selectors")}}{{Spec2("CSS3 Selectors")}} 
{{SpecName("CSS2.1", "selector.html#id-selectors", "ID selectors")}}{{Spec2("CSS2.1")}} 
{{SpecName("CSS1", "#id-as-selector", "ID selectors")}}{{Spec2("CSS1")}}Definició inicial
+ + + +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
DescripcióChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
Suport bàsic{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
DescripcióAndroidChrome for AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Suport bàsic{{CompatUnknown}}{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
-- cgit v1.2.3-54-g00ecf