Types of CSS Attribute Selectors Semalt Expert

Page 1

23.05.2018

Types Of CSS Attribute Selectors – Semalt Expert

An HTML element consists of a class, ID and attributes. An attribute selector picks the HTML elements that feature an attribute or with an attribute value. Attribute selectors provide a simple method of applying styles on HTML elements with a particular attribute or trait value. Attribute selectors are de ned by two square brackets, which enclose the attribute with its value. Still, you can put an element type selector before it. The CSS [attribute] Selector applies the style rules to an element if and when it consists of a given trait.

Types of attribute selectors There are different types of attribute selectors each of which can be used for separate cases: CSS [attribute|="value"] Selector highlights elements that have a particular trait, and it starts with a de ned value. CSS [attribute~="value"] Selector is utilized to nd elements with a property value featuring a speci c word. http://rankexperience.com/articles/article2446.html

1/3


23.05.2018

CSS [attribute^="value"] Selector nds elements with a property value begging with a speci c value. The value is not necessarily a whole word. CSS [attribute$="value"] Selector nds components which has an attribute value ending with a de ned value.

Applications of the CSS attribute selectors There are various ways in which the attribute selector can be used instead of using the universal, class or ID selector The most common use of attribute selectors is on inputs. These include the text selectors, checkbox selectors, password selectors, le selectors, hidden selectors, password selectors, radio selectors, reset selectors and others.

Styling forms The attribute selectors are very useful when styling forms without class or ID.

Style links For instance, attribute selectors can be used to style a blogroll where you have a list of links to friend sites. However, you wish is that each link is styled differently. The traditional way to go about it is to assign a calls name which would require more markups. Still, you could use the nth-child which requires that the orders never change. Using the attribute selectors makes it so easy since there is an attribute that you can target.

Border inputs Styling borders elements using the CSS border image attribute is an elegant way to add images to the body. It allows you to de ne an image as an element's border. The border image could be scaled, sliced, repeated in different ways to ensure that it ts in the border area. The borders radius attribute allows one to add rounded corners without using images. The property de nes the shape of the corner.

Styling colors The CSS attribute selectors make it simple to style all elements that have particular color value. You can use the color keyword, RGB (), RGBA (), HSL () and HSLA () notations. The RGBA color values are an extension of the RGB color model with a channel that de nes the opacity of a color. The parameters value ranges from from1.0 (opaque} to 0.0(transparent) The HSL color model is explained as the (Hue_saturation_Lightness). Hue representation is in the form of angle (0360) or the color wheel. Saturation and lightness are measured as percentages 0% of saturation represents shade http://rankexperience.com/articles/article2446.html

2/3


23.05.2018

or gray while 100 represents full color. 100% lightness represents white while 0% is black.

http://rankexperience.com/articles/article2446.html

3/3


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.