From 77d2e5e755a234f9b4cfcd2db6e126799b1be323 Mon Sep 17 00:00:00 2001 From: CJ Wright Date: Fri, 14 Dec 2018 22:15:42 -0500 Subject: [PATCH] Update ID selector with basic information. (#23865) * Update ID selector with basic information. * Fixed typos, formatting, grammar --- .../english/css/selectors/general/id/index.md | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/guide/english/css/selectors/general/id/index.md b/guide/english/css/selectors/general/id/index.md index af9f5c7704..db423159a1 100644 --- a/guide/english/css/selectors/general/id/index.md +++ b/guide/english/css/selectors/general/id/index.md @@ -1,15 +1,26 @@ --- title: Id --- -## Id -This is a stub. Help our community expand it. +# ID -This quick style guide will help ensure your pull request gets accepted. +the "id" selector is used within a html/css file in order to style a unique element on a page. Unlike other kinds of selectors such as attributes or class selectors, an id can only be used on a single element in a page. - +## Using an Id selector -#### More Information: - +### HTML example +To use an Id selector within an HTML file, you must simply assign the id within the opening tags of an html attribute like shown below. Not that the Id should not include spaces and should be surrounded by quotes. +```html +

To do our best!

+``` +### CSS example +Once you have added a unique Id selector to your page, you can add specific styling to the id you've selected using CSS as shown below. +```css +#company-motto { + font-weight: 900; +} +``` +## Notable features +When one or more elements with the same Id are present within the same html file, only the first instance of the the Id will have the style. Additionally because Ids are unique selectors, they should only be used when an element absolutely has to have a specific style and therefore has a high specificity in order for its styling to take precedence over other possible selectors.