CSS Articles

Page 21 of 130

Role of CSS :only-of-type Selector

Ankith Reddy
Ankith Reddy
Updated on 11-Mar-2026 172 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                    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.          

Read More

Role of CSS :only-child Selector

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 193 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 selector                    p:only-child {             background: orange;          }                     Heading                This is a paragraph.                      This is a paragraph.          This is a paragraph.          This is a paragraph.          

Read More

Role of CSS :optional Selector

radhakrishna
radhakrishna
Updated on 11-Mar-2026 231 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:                    input:optional {             background-color: blue;          }                              Subject:          Student:          

Read More

Style <input> elements with a value outside a specified range with CSS

seetha
seetha
Updated on 11-Mar-2026 208 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:                    input:out-of-range {             border: 3px dashed orange;             background: yellow;          }                           The style only works for the value entered out of range    

Read More

Role of CSS : read-only Selector

vanithasree
vanithasree
Updated on 11-Mar-2026 178 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:                    input:read-only {             background-color: blue;             color: white;          }                              Subject:          Student:          

Read More

Style <input> elements with a "readonly" attribute with CSS

George John
George John
Updated on 11-Mar-2026 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 selector                    input:read-only {             background-color: blue;             color: white;          }                              Subject:          Student:          

Read More

Role of CSS :read-write Selector

usharani
usharani
Updated on 11-Mar-2026 131 Views

Use the CSS :read-write selector to select elements that are ‘readable’ and ‘writable’.ExampleYou can try to run the following code to implement the :read-write selector:                    input:read-write {             background-color: blue;             color: white;          }                              Subject:          Student:          

Read More

Role of CSS :required Selector

Sreemaha
Sreemaha
Updated on 11-Mar-2026 228 Views

Use the CSS :required selector to style <input> elements with a "required" attribute. You can try to run the following code to implement the :required selector:Example                    input:required {             background-color: orange;          }                              Subject:          Student:          

Read More

Role of CSS :target Selector

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 320 Views

Use the CSS :target selector to highlight active HTML anchor with CSS.ExampleYou can try to run the following code to implement the :target Selector                    :target {             border: 2px solid #D4D4D4;             background-color: orange;             color: white;          }                     Click any of the subject below.       Maths       Java       C++       C       This is demo text.       This is demo text.       This is demo text.       This is demo text.       This is demo text.       Maths Tutorial       Java Tutorial       C++ Tutorial       C Tutorial    

Read More

Role of CSS :visited Selector

varma
varma
Updated on 11-Mar-2026 243 Views

Use the CSS : visited selector to style all visited links.ExampleYou can try to run the following code to implement the :visited selector:                    a:link, a:visited {             background-color: white;             color: black;             border: 1px solid blue;             padding: 30px 30px;             text-align: center;             text-decoration: none;             display: inline-block;          }          a:hover, a:active {             background-color: red;             color: white;          }                     Demo Link    

Read More
Showing 201–210 of 1,299 articles
« Prev 1 19 20 21 22 23 130 Next »
Advertisements