Found 1566 Articles for CSS

Style elements with a "readonly" attribute with CSS

George John
Updated on 01-Jul-2020 09:15:24

2K+ Views

To select elements that are read-only, use the CSS :read-only selector.ExampleYou can try to run the following code to implement the :read-only selectorLive Demo                    input:read-only {             background-color: blue;             color: white;          }                              Subject:          Student:          

Role of CSS : read-only Selector

vanithasree
Updated on 01-Jul-2020 09:15:00

86 Views

Use the CSS :read-only selector to select elements that are read-only.ExampleYou can try to run the following code to implement the :read-only selector:Live Demo                    input:read-only {             background-color: blue;             color: white;          }                              Subject:          Student:          

Role of CSS: out-of-range Selector

Chandu yadav
Updated on 01-Jul-2020 09:14:33

42 Views

Use the CSS :out-of-range selector to style elements with a value outside a specified range.ExampleYou can try to run the following code to implement the :out-of-range selectorLive Demo                    input:out-of-range {             border: 3px dashed orange;             background: yellow;          }                           The style only works for the value entered out of range    

Style elements with a value outside a specified range with CSS

seetha
Updated on 01-Jul-2020 09:14:05

104 Views

Use the CSS :out-of-range selector to style elements with a value outside a specified range.ExampleYou can try to run the following code to implement the :out-of-range selector:Live Demo                    input:out-of-range {             border: 3px dashed orange;             background: yellow;          }                           The style only works for the value entered out of range    

Style element with no "required" attribute with CSS

varun
Updated on 01-Jul-2020 09:01:42

171 Views

Use the CSS :optional selector to style elements with no "required" attribute.ExampleYou can try to run the following code to implement the :optional selector:Live demo                    input:optional {             background-color: blue;          }                              Subject:          Student:          

Role of CSS :optional Selector

radhakrishna
Updated on 01-Jul-2020 09:01:11

135 Views

Use the CSS :optional selector to style elements with no "required" attributeExampleYou can try to run the following code to implement the :optional selector:Live Demo                    input:optional {             background-color: blue;          }                              Subject:          Student:          

Role of CSS :only-child Selector

Arjun Thakur
Updated on 01-Jul-2020 08:59:40

92 Views

Use the CSS :only-child selector to style every element that is the only child of its parent.ExampleYou can try to run the following code to implement the :only-child selectorLive Demo                    p:only-child {             background: orange;          }                     Heading                This is a paragraph.                      This is a paragraph.          This is a paragraph.          This is a paragraph.          

Style every element that is the only element of its parent with CSS

Prabhas
Updated on 01-Jul-2020 08:59:10

93 Views

Use the CSS :only-of-type selector to style every element that is the only element of its parent.ExampleYou can try to run the following code to implement the :only-of-type selector:Live Demo                    p:only-of-type {             background: orange;             color: white;          }                              This is demo text 1.                      This is demo text 2.          This is demo text 3.          This is demo text 4.          

Role of CSS :only-of-type Selector

Ankith Reddy
Updated on 01-Jul-2020 08:58:41

78 Views

Use the CSS :only-of-type selector to style every element that is the only element of its parent.ExampleYou can try to run the following code to implement the :only-of-type selectorLive Demo                    p:only-of-type {             background: orange;             color: white;          }                              This is demo text 1.                      This is demo text 2.          This is demo text 3.          This is demo text 4.          

Style every element that is the nth element of its parent with CSS

George John
Updated on 30-Jun-2020 11:15:07

110 Views

Use the CSS :nth-of-type(n) selector to style every element that is the nth element of its parent. You can try to run the following code to implement the :nth-of-type(n) selectorExampleLive Demo                    p:nth-of-type(2) {             background: yellow;          }                     This is demo text 1.       This is demo text 2.       This is demo text 3.       This is demo text 4.    

Advertisements